StateMachine¶
Machine state model with operator commands, PackML (ISA-TR88.00.02) by default (IND-060 .. IND-063).
Not a safety-related system
A state model in a notebook runs with no timing guarantee. It is for visualization, teaching, simulation and supervision; it is not a safety-related system and must not perform a safety function. See the safety notice.

Supervisory objects · Widget catalog · API reference ·
schema statemachine.schema.json
Example¶
The traits of the picture above:
ai.StateMachine(label="StateMachine (PackML)")
Traits¶
| Trait | Type | Default | Set by | Description |
|---|---|---|---|---|
size |
array | [720,380] |
host | [width, height] in CSS pixels. |
machine |
object | … | host | State model: {states: [{name, x, y, acting, title, group}], transitions: [[from, command, to]], commands, initial, global_commands, zones, routes}; the command SC completes an acting state (a host event). Missing positions, acting flags, commands and initial state are completed as the kernel does; an invalid model reads as this default (PackML). |
value |
string | "" |
derived | Current state. Empty or unknown: the initial state of the model. Written by the host, or by the front end when it applies an operator command without a host (HOST-012). |
available_commands |
array of string | [] |
derived | Commands valid in the current state (IND-061). Derived from machine and value. |
last_command |
string | "" |
derived | Last command applied. |
Common traits (8), shared with other widgets
| Trait | Type | Default | Set by | Description |
|---|---|---|---|---|
mode |
"control", "indicator" |
"control" |
host | "control": the user sets the value; "indicator": display only. |
label |
string | "" |
host | Plain text, never interpreted as HTML (SEC-002). |
disabled |
boolean | false |
host | Greyed out, input rejected. |
visible |
boolean | true |
host | |
tooltip |
string | "" |
host | Plain text shown on hover. |
style |
"modern", "classic", "system" |
"modern" |
host | |
theme |
"auto", "light", "dark", "system" |
"auto" |
host | "auto": the style decides; "system": the host page or the operating system (STYLE-007). |
skin |
object | {} |
host | Replaceable drawing parts: part name -> SVG source, sanitized (STYLE-005, STYLE-006). |
Set by: host, the program (Python, Julia, ...); widget, the user through the widget;
derived, computed from other traits by the host that owns the state, or by the widget.
See the trait contract.