The short answer
Sequencers
A sequencer moves a piece of equipment through a fixed series of steps, each with the actions it performs, the condition that completes it, a timeout, and a defined response to a fault. It is implemented as an integer step number with a case structure, a drum or sequencer output instruction for fixed output patterns, or a sequential function chart where the platform supports it. Every step has a timeout with an alarm, transitions are driven by feedback rather than assumed, faults either hold the sequence or abort it to a safe state as the functional description decides, and after a power loss the sequence restarts from a recovery step that evaluates the plant rather than from wherever it was.
Key points
- Fixed order, one active step, feedback-driven transitions: that is a sequencer. Arbitrary transitions are a state machine.
- Every step has a number, a name, actions, a completion condition, a timeout, and a fault response.
- Integer step and case structure runs on any platform and is the easiest to read in the field.
- Timeouts with alarms turn a stuck sequence into a diagnosed one: the alarm names the step and what it was waiting for.
- Hold keeps outputs and waits; abort drives outputs to a safe state. Decide per step, in the functional description.
- After a power loss the sequence goes to a recovery step, never straight back to the step it was in.
What a sequencer is for
Some operations always happen in the same order. A filter backwash closes the influent valve, drains to a level, air scours, washes, settles, filters to waste, and returns to service. A high-service pump start pre-lubricates, opens the suction valve, starts the motor, and opens the discharge valve slowly. A polymer batch fills to a level, adds neat polymer for a time, mixes, and ages. Each of these is a list of steps, and the controller code that runs them is a sequencer. The alternative, a tangle of timers and latches that happens to produce the right order, works until someone has to change step four.
What every step needs
- Number and name
- Numbered by tens so a step can be inserted later; named in the words the operators use. Step 30, Air Scour.
- Actions
- The outputs held while the step is active: valves open, blower running. Outputs not named are in their default state.
- Completion condition
- Feedback, not assumption: a valve limit switch, a level, a flow, an analyzer reading, or a timer where time is the only measure. A step that waits for a valve to open watches the open limit, not a five-second timer.
- Timeout
- The longest the step may take before something is wrong, with an alarm that names the step and the condition it was waiting for.
- Fault response
- Hold, abort, or retry, decided per step. A timeout on the drain step may hold and wait for the operator; a timeout on the discharge valve during a pump start aborts and stops the pump.
- Manual advance
- A supervisor-level button that forces the transition, for commissioning and for the day a limit switch is broken, logged when used.
Three ways to build one
| Method | How it works | Best for | Watch out for |
|---|---|---|---|
| Integer step with case structure | A step register holds the current step; a case statement or a set of equal-compare rungs runs the logic for that step and sets the next step number | Anything; readable on every platform; easy to add steps | Every write to the step register must be in one place, or two rungs fight over it |
| Drum or sequencer output instruction | A table of output patterns indexed by step, advanced by time or by an event input | Fixed output patterns such as wash cycles and simple valve sequences | Conditions and timeouts live outside the instruction; harder to see what is waiting |
| Sequential function chart | Graphical steps and transitions with actions attached; parallel branches supported | Long sequences with parallel paths, on platforms and with staff that know it | Not every platform has it; a field technician who has never seen one cannot troubleshoot it at 2 a.m. |
Example: filter backwash
| Step | Actions | Completion | Timeout | On timeout |
|---|---|---|---|---|
| 0 Idle | Filter in service | Backwash request and permissives true | none | none |
| 10 Isolate | Close influent valve, close effluent valve | Both closed limits | 2 min | Abort, alarm valve |
| 20 Drain down | Open drain or waste valve | Level below air scour level | 30 min | Hold, alarm |
| 30 Air scour | Open air valve, start blower | Timer, typically a few minutes | timer + 1 min | Abort, alarm blower |
| 40 Air and water | Start wash pump at low rate with air | Timer | timer + 1 min | Abort |
| 50 Water wash | Stop blower, close air valve, wash pump to high rate | Timer, or waste turbidity below setpoint | timer + 2 min | Hold, alarm |
| 60 Settle | Stop wash pump, close wash valves | Closed limits, settle timer | 5 min | Alarm valve |
| 70 Filter to waste | Open influent, open waste valve | Effluent turbidity below setpoint | Per the plant | Hold, alarm |
| 80 Return | Close waste valve, open effluent valve | Effluent open limit | 2 min | Alarm valve |
Coding pattern
CASE BW_Step OF
10: (* Isolate *)
FV_Influent_Close := TRUE; FV_Effluent_Close := TRUE;
IF ZSC_Influent AND ZSC_Effluent THEN BW_Step := 20; END_IF;
IF BW_StepTimer.ET > T#2m THEN BW_Fault := TRUE; BW_Step := 900; END_IF;
20: (* Drain down *)
FV_Waste_Open := TRUE;
IF LT_Filter_PV < BW_ScourLevel THEN BW_Step := 30; END_IF;
IF BW_StepTimer.ET > T#30m THEN BW_Hold := TRUE; END_IF; (* hold, alarm *)
30: (* Air scour *)
FV_Air_Open := TRUE; Blower_RunCmd := TRUE;
IF BW_StepTimer.ET > BW_ScourTime THEN BW_Step := 40; END_IF;
(* ... *)
900: (* Abort: safe state *)
Blower_RunCmd := FALSE; WashPump_RunCmd := FALSE;
FV_Air_Open := FALSE; FV_Waste_Open := FALSE;
IF BW_Reset THEN BW_Fault := FALSE; BW_Step := 0; END_IF;
END_CASE;
(* Step timer restarts on any step change; step number written only inside the CASE *)Two disciplines keep this readable for years. The step number is written only inside the case structure, so there is exactly one place to look for how the sequence advances. And outputs are set inside the step that uses them and cleared in a common section that runs when the step changes, so a step cannot leave a valve open by forgetting to close it.
Faults, holds, and power loss
A hold freezes the sequence in its current step with outputs as they are, and waits for an operator to resume, advance, or abort. It fits steps where waiting is safe, such as a drain that is slow because the waste line is restricted. An abort drives every output the sequence controls to a defined safe state and goes to an abort step that waits for a reset. It fits steps where waiting is not safe, such as a blower running against a closed valve. The functional description says which applies to each step; the code should not guess.
Power loss in the middle of a sequence is the case that gets forgotten. If the step number is retentive, the controller powers up in step 50 with the wash pump commanded to run and the valves in whatever positions they drifted to. If it is not retentive, the sequence restarts at idle with the filter half drained and the influent valve closed, and the filter sits there. The robust answer is a recovery step: on first scan, the sequence goes to a step that reads the valve positions and level, alarms that a sequence was interrupted, and either returns to idle safely or lets the operator choose where to resume.
What the HMI shows
- The current step number and name, in the same words as the functional description.
- The step timer and the timeout, so a slow step is visible before it alarms.
- The condition the step is waiting for, as text: Waiting for influent valve closed limit.
- Start, hold, resume, abort, and the supervisor-level advance, each logged.
- The last completed sequence with its total time and any holds, and a trend of step durations over time; a wash that takes longer every week is telling you something.
Frequently asked questions
- What is the difference between a sequencer and a state machine?
- A sequencer runs a fixed list of steps in order and returns to idle; the only branches are hold and abort. A state machine has a set of states with transitions in any direction, such as a pump that moves between stopped, starting, running, stopping, and failed. Use a sequencer for an operation with a beginning and an end, and a state machine for equipment that lives in modes.
- Where do the step times come from?
- From the functional description, which got them from the process designer, the equipment manufacturer, and the plant. Put them in setpoint registers with limits, editable from a supervisor screen, never as constants in the code. A wash duration that has to be changed by a programmer is a wash duration that never gets optimized.
- Can two sequences run at the same time?
- Two sequences on different equipment, yes; each has its own step register and code. Two filters backwashing at once is a process question, and usually the answer is a permissive that lets only one backwash run at a time because the wash supply and the waste handling are sized for one.
- How do I test a sequence without running the plant?
- With the outputs disabled or the equipment isolated, step through it with simulated feedback: force the limit switches and levels in the order the sequence expects, then in the wrong order, then not at all, and confirm every timeout and abort behaves. Then run it once for real with someone at the equipment. Sequences that were only tested on the happy path fail on the first unhappy one.
Related topics
- State Machines in PLC ProgramsWriting sequences as explicit states instead of tangled interlock chains: what a state is, how transitions are written, the pattern in structured text and in ladder, publishing the state to the HMI, and the failure handling every state machine needs.
- PermissivesThe conditions that must be true before a device may start: how permissives differ from interlocks and trips, the list a pump or feeder usually needs, coding them so the HMI can say why a start was refused, and the rules for time delays and bypasses.
- Interlocks and PermissivesA permissive lets you start. An interlock stops you. Confusing the two produces equipment that either will not run or will not protect itself.
- Structured TextThe text language of IEC 61131-3: syntax, control structures, how it fits alongside ladder, the conventions that keep it readable for the next person, and the mistakes that make structured text a liability in a plant that troubleshoots online.
- Retentive MemoryWhat survives a power cycle in a controller and what does not, how retention is backed up by battery, capacitor, or nonvolatile storage, what should be retentive, and how retained data gets lost.
- Well Pump ControlControlling a groundwater well: submersible and line-shaft turbine pumps, the pump-to-waste start, drawdown and the low-water cutoff, cycling limits from the well and the aquifer, and what the controller monitors to protect a pump that cannot be seen.
Direct contact
Have a controls question?
Reach Eric Sullivan directly about anything on this site, a controls or automation topic, or one of his personal projects.