STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
feedtwin.session.statemachine Namespace Reference

Functions

bool fills (str state, str side)

Variables

int MACHINE_SCHEMA = 1
dict KEYED_STATES
dict FILL_WORDS = {"lox": ("ox", "lox"), "fuel": ("fuel", "eth")}
dict _NOISE = {"valve", "sv", "bv", "nv", "av", "act", "the"}

Detailed Description

The stand's state machine, read from the same tables the DAQ runs on.

The DAQ does not have a state machine written in code; it has two CSVs, and the
firmware and the GUI both read them. So does this. Copying the *behaviour* into
Python would have created a second source of truth that drifts silently the
first time somebody adds a state -- and the whole point of the twin is that it
does what the stand does.

``state_machine_actuators.csv``
    A matrix. One row per actuator, one column per state, ``OPEN`` or ``CLOSE``
    in each cell. This is what a state *is* on this stand: a column.

``state_transitions.csv``
    Which moves are legal, as a square 0/1 matrix. Idle cannot go straight to
    Fire; it goes through Armed and the press states. Enforcing that here means
    the twin refuses the same sequences the stand refuses, which is most of what
    makes it useful for training somebody.

Matching actuators to a drawing
-------------------------------
The tables name actuators the way the crew does -- "LOX Main", "Fuel Vent". A
P&ID names them however the person drawing it typed them -- "MV-OX", "MVO",
"SV-FUEL-VENT". So the join is fuzzy and, more importantly, *reported*: a run
says which actuators matched a symbol and which did not, because an unmatched
"LOX Main" means the main valve is not being commanded at all and the trace
would look like a very smooth start.

Function Documentation

◆ fills()

bool feedtwin.session.statemachine.fills ( str state,
str side )
Whether the session loads a ``side`` (``lox``/``fuel``) tank in
``state``: by its name, as :data:`FILL_WORDS` reads it.

Definition at line 56 of file statemachine.py.

Variable Documentation

◆ _NOISE

dict feedtwin.session.statemachine._NOISE = {"valve", "sv", "bv", "nv", "av", "act", "the"}
protected

Definition at line 65 of file statemachine.py.

◆ FILL_WORDS

dict feedtwin.session.statemachine.FILL_WORDS = {"lox": ("ox", "lox"), "fuel": ("fuel", "eth")}

Definition at line 53 of file statemachine.py.

◆ KEYED_STATES

dict feedtwin.session.statemachine.KEYED_STATES
Initial value:
1= {
2 "Idle": "a stand opens in Idle",
3 "Ready": "T-0 primes in Ready",
4 "Fire": "Fire burns",
5 "Vent": "a dry tank vents to Vent",
6 "Engine Abort": "ENG ABORT goes to Engine Abort",
7}

Definition at line 42 of file statemachine.py.

◆ MACHINE_SCHEMA

int feedtwin.session.statemachine.MACHINE_SCHEMA = 1

Definition at line 38 of file statemachine.py.