Reddy GeneratorsREDDY GENERATORSThe dependable power professionals

Control State Machines and Sequence Engineering

How to design power-control sequences as state machines: states, transitions, guards, timeouts, safe fall-backs, recovery after restart and test methods that cover every path.

In short. A state machine describes a sequence as a set of states and the exact conditions for moving between them. It makes behaviour predictable, including what happens on timeout, fault or restart. Sequences written as loose rungs of logic hide dead ends that only show up in an emergency.

Elements

ElementMeaning
StateA stable condition, such as Standby, Starting, On load, Fault
TransitionA move from one state to another
GuardThe condition that must be true for the transition
ActionWhat the controller does on entry, during or on exit
TimeoutMaximum time allowed in a state

Design rules

  1. Every state has at least one exit, including a fault exit.
  2. Every state that waits has a timeout and a defined timeout action.
  3. Only one state is active at a time.
  4. Transitions depend on confirmed feedback, not on commands issued.
  5. A fault or emergency state can be entered from any state.
  6. Manual and automatic modes are explicit states or modes, not hidden flags.

Restart behaviour

After a controller power cycle, the machine should not assume it is in its last state. Read the real plant state, breaker positions and source health, then choose the correct state. Never close or open anything just because the program restarted. See PLC architecture.

Documenting

Testing

Test each transition: the normal path, the guard failing and the timeout. Also test illegal sequences, such as two commands at the same time. A coverage table that shows every transition tested is the evidence.

Illustrative example

A start-and-transfer machine has states Standby, Cranking, Running, Stabilising, Transferring, On generator, Retransferring, Cool-down and Lockout. The Stabilising state has a 30 second timeout; if source voltage is not acceptable, it moves to Lockout and alarms, instead of waiting indefinitely. Tests simulate a bad voltage and confirm the transition.

Why sequences are written as state machines

Control logic written as a tangle of latches is hard to test and harder to fix. A state machine has a defined set of states, a clear transition for each event and a safe response to anything unexpected.

ElementRule
StatesNamed, finite, one active at a time
TransitionsEach with a condition and a timeout
ActionsEntry, during and exit actions defined
Fault stateReachable from any state
ResetDeliberate and conditional

Every step needs a timeout

A step that waits for a condition forever can hang the plant. Give each wait a timeout and a defined failure action. For example, waiting for breaker closed feedback: timeout 2 seconds, then alarm and revert to the safe state.

Example: generator start sequence

  1. Idle, ready.
  2. Pre-start checks (fuel, battery, no alarms).
  3. Crank, with attempt count.
  4. Run-up, wait for speed and voltage.
  5. Available, wait for close permissive.
  6. On load.
  7. Cool-down.
  8. Stop.

Test the state diagram

Walk through every transition in simulation, including events in the wrong order. Record the result. See ATS and AMF logic and cause-and-effect engineering.

The master engineering question

Is there any state from which the plant cannot leave, or any restart condition that could cause an unintended breaker operation?

What to send us

Send your sequence descriptions. Send your application details.

Questions engineers ask

Why not simple ladder logic?

It works for small tasks, but complex sequences become hard to verify.

Can a state machine be drawn from existing logic?

Yes. Reverse engineering often finds hidden states and gaps.

How many states are too many?

If a diagram cannot be understood on one page, split into sub-machines.

Do generator controllers use state machines?

Yes, internally; know their states when integrating.

This guide gives general principles. Confirm with a project design.

CallWhatsAppEnquire
STAGING PREVIEW ยท NOT INDEXED