Finite State Machines (FSM)
The ECU utilizes multiple Finite State Machines (FSMs) leveraging the generic_fsm_driver from the common repository to manage the complex transitions in vehicle state.
FSM Hierarchy
The ECU defines the following FSMs to manage distinct phases of operation:
- ECU FSM: The master state machine handling overall system states (Init, Idle, R2D, Control, Shutdown) and critical fault events (SDC, AMS). See the ECU flow diagram.
- R2D FSM: The Ready-to-Drive state machine governing the safe startup sequence (button presses, precharge, buzzer). See the R2D FSM diagram.
- Control FSM: The active driving state machine managing cooling, APPS validation, and motor control execution. See the Control FSM diagram.
- Shutdown FSM: The state machine responsible for safely executing the shutdown procedure, managing SDC relays and delay timers. See the Shutdown FSM diagram.
Each FSM independently evaluates its own event snapshot and requested transitions, allowing for a decoupled and robust safety architecture.
