Skip to content

CLI Reference

santisoutoo edited this page Jul 24, 2026 · 1 revision

CLI Reference

a320-cli is the human window onto the core: flip switches, read buses, advance time, inject failures, and watch the aircraft respond. It contains no simulation logic — every command maps 1:1 onto the a320_sim.Sim API (the same core the MCP-Server drives).

Start it with a320-cli (or python -m a320_cli). The prompt shows the simulated clock: a320 [t= 3.2s]>. Errors — an unknown control, a value out of range, a bad argument — print a one-line error: … message and return to the prompt; a traceback is never shown.

Commands

Command What it does
set <control> <value> Actuate a control. <control> is a friendly name (bat_1, ext_pwr, bus_tie…) or a raw LVAR. <value> is a number or a friendly boolean: on/off, true/false, yes/no, auto (auto = on). Tab-completes control names.
get <var> [<var> …] Read one or more variables (LVAR names, e.g. ELEC_DC_BAT_BUS_IS_POWERED). Tab-completes.
step [<ms>] Advance one tick of <ms> ms (default 1000). A single tick; for settling use run or watch.
run <seconds> [<rate_hz>] Advance <seconds> at <rate_hz> (default 5 Hz), as fast as it computes (no sleeping).
env <alt_ft> <ias_kt> <oat_c> <qnh_hpa> Set the outside world (the UpdateContext). Ground electrical typical: env 0 0 15 1013.25.
snapshot [<substr>] Full state dump, optionally filtered to names containing <substr>. With no arg, prints the variable count and a hint.
controls List the curated, actuable controls (name, kind, valid values, group, LVAR).
vars [<substr>] List known variable names, optionally filtered.
fail <id> Inject a failure by its stable id (e.g. fail elec.tr.1). Takes effect on the next tick — follow with run 2. Tab-completes.
unfail <id> Clear an injected failure. Idempotent (clearing an inactive failure is fine).
failures List the injectable failures, marking active ones with *. Shows the FBW ata cross-reference.
ecam Show active ECAM warnings/cautions, worst first. Each line marks [fbw] or [ours] for the rule's origin.
watch <var> [<var> …] Live view: advance at ~5 Hz and re-render the vars in place until Ctrl+C.
help [<command>] Command list, or detailed help for one command.
quit / exit / Ctrl+D Leave the REPL.

Value parsing for set

on / true / yes / auto / 11.0; off / false / no / 00.0; anything else is parsed as a float and handed to the core, which validates the range. auto = on because the battery and bus-tie pushbuttons use AUTO as their "in the loop" state.

Range validation is the core's job (see Controls-and-Variables): a boolean control rejects anything that isn't 0/1, a range control rejects out-of-bounds values, and the CLI just translates the alias.

Notes

  • Time does not pass by itself. A control you set has no effect until you advance (step / run / watch). If you set something and immediately get it back, you see the pre-action state.
  • watch is TTY-aware. On a real terminal it redraws the same lines in place. When stdout is piped, it prints one compact line per refresh so transitions read cleanly in a log.
  • Discovery. controls lists what you can write; vars <substr> and snapshot <substr> find readable variables (the full registry is hundreds of names).

See Quickstart for a worked cold-&-dark → external-power session, and Failures-and-ECAM for the fail / ecam loop.

Clone this wiki locally