STOP_ALL
Stops the plant and holds every active PCS at zero power.
| Mode string | STOP_ALL (EMS_OP_STOP_ALL) |
| Dispatcher | ems_main.py → control_logic_updated.control_step_stop_all |
| Config block | none, by design |
| Queue action | set_power_kw (value 0.0) |
| Queue source tag | stop_all |
| Status | Implemented |
Purpose
A safety action rather than a control strategy. Selecting this mode:
- Discards unapplied automatic power setpoints left behind by the other modes, so a stale command cannot be applied after the stop.
- Queues an explicit
0 kWfor every active PCS.
Step 2 matters. Discarding alone would only empty the queue — each PCS would stay at whatever setpoint it last applied. Queuing zero is what actually stops the plant.
Why there is no config block
Every other mode is gated by functions.<Mode>.enabled. STOP_ALL deliberately is not:
Selecting a mode named "STOP_ALL" must never silently do nothing.
There is no functions.Stop_All block and no enable flag. If you select it, it acts. The only thing
that can prevent it from running is the surrounding dispatch structure, described below.
Configuration
None. STOP_ALL has no entry in ems_control_setting.json.
Reachability
The branch sits in the normal dispatch chain, so it is skipped in exactly the two situations where normal dispatch is skipped anyway:
| Situation | Behaviour |
|---|---|
is_diagnostic_test_active() |
Dispatch chain is skipped; the diagnostic interlock already queues its own zeros. |
ems_control_mode == "external_control" |
The external bridge owns the PCS; dispatch chain is skipped. |
In both cases ems_main.py continues the loop before reaching the mode branches.
Idempotency
control_step_stop_all runs every cycle. The power writer replaces (rather than appends) unapplied
setpoints from the stop_all and control_logic sources, so repeated cycles keep exactly one
pending 0 kW per PCS instead of stacking one per cycle.
This is also why the zeros use their own stop_all source rather than control_logic: the discard
helper removes control_logic power commands, so a control_logic-sourced zero would be discarded
by the next cycle's discard step before the PCS client could apply it.
Safety
- Preserves manual/operator commands and
mode_pq/mode_vfswitches — the discard step only removes automaticcontrol_logicpower setpoints. Starting aSTOP_ALLdoes not override an operator's manual command. - Zero is clamped through the same
_pcs_connect_and_set_power_kwpath as every other mode. - Failures are caught per cycle in
ems_main.pyand logged as[EMS][WARN] STOP_ALL failed: ...without killing the loop.
Review: confirm that preserving manual commands is the intended semantics for your emergency stop. If
STOP_ALLis meant to be a hard stop that also overrides manual commands, the discard filter and source list need widening.
Outputs
discard_pending_automatic_power_commands()→ removes queuedcontrol_logicpower setpoints.queue_diagnostic_zero_power_commands(source="stop_all")→ oneset_power_kw= 0.0 per active PCS, sourcestop_all.- Log line:
[STOP_ALL] discarded N pending automatic setpoint(s); queued 0 kW for M active PCS.