Standard State Machine Pattern for Roll Forming PLC Sequences
Introduction — Why State Machines Are Used in Roll Forming PLC Programs
Roll forming machines contain complex production sequences. Material flows through multiple stations including:
- uncoiler
- entry guides
- forming stands
- punching systems
- cutting systems
- stackers.
Each system must operate in the correct order for the machine to function safely and efficiently.
Traditional PLC programs sometimes attempt to manage these sequences using scattered logic and individual timers. This approach quickly becomes difficult to maintain and troubleshoot.
To solve this problem, many automation engineers use a state machine programming pattern.
A state machine organizes machine operation into clear steps or “states.” The PLC moves from one state to another only when certain conditions are satisfied.
This structured approach makes roll forming PLC programs easier to understand, debug, and expand.
What Is a PLC State Machine?
A state machine is a programming structure where the machine operates in one defined state at a time.
Each state represents a specific stage of machine operation.
Examples of machine states include:
- Idle
- Ready
- Threading
- Running
- Cutting
- Fault.
The PLC continuously checks the conditions required to move from one state to the next.
When the conditions are satisfied, the machine transitions to the next state.
Benefits of State Machine Programming
Using a state machine structure provides several advantages.
These include:
Clear Machine Behavior
Each state has a defined purpose and behavior.
Easier Troubleshooting
Technicians can quickly see which state the machine is in.
Safer Operation
Transitions only occur when safety and readiness conditions are satisfied.
Expandable Programs
New machine functions can be added without rewriting the entire program.
Typical Roll Forming Machine States
Although machines vary, most roll forming PLC programs include several core states.
Idle State
In the idle state, the machine is powered but not producing material.
Typical conditions include:
- motors stopped
- no active sequences
- operator controls enabled.
The machine remains in idle until the operator requests operation.
Ready State
In the ready state, the machine has passed all interlock checks and is prepared to start production.
Typical checks include:
- safety circuits healthy
- hydraulic pressure available
- punch and shear in home position
- stacker ready.
The machine waits for the operator start command.
Threading State
Threading mode is used when loading new material into the machine.
Typical characteristics include:
- low jog speed
- punching disabled
- cutting disabled.
Operators guide the strip through the forming stations during this state.
Production State
In the production state, the machine runs automatically.
Typical operations include:
- encoder length tracking
- punching patterns
- cut-to-length control
- stacker operation.
This is the main operating state of the machine.
Cut Cycle State
During a cut cycle, the PLC temporarily changes machine behavior.
Typical actions include:
- stopping the line (for stop-to-cut systems)
- activating the shear
- confirming blade position.
Once the cut is complete, the machine returns to production.
Fault State
If a machine fault occurs, the PLC transitions to the fault state.
Typical causes include:
- drive faults
- hydraulic pressure loss
- safety circuit activation.
In this state, the machine stops and waits for operator intervention.
PLC State Machine Structure
State machines are typically implemented using a variable that stores the current state.
For example:
MachineState = Idle
MachineState = Ready
MachineState = Run
MachineState = Fault.
The PLC logic checks the current state and executes the corresponding program section.
Transitions occur when conditions are satisfied.
Example State Machine Sequence
A simplified roll forming sequence might look like this:
Idle → Ready → Threading → Production → Cut → Production → Fault (if necessary).
Each transition requires specific conditions.
Example:
Idle to Ready requires safety circuits and machine readiness.
Ready to Production requires operator start command.
Production to Cut occurs when panel length is reached.
Transition Conditions
Transitions between states must be carefully defined.
Typical transition conditions include:
- operator commands
- sensor signals
- encoder positions
- timer conditions.
Transitions should only occur when all required conditions are satisfied.
Example Transition Logic
Example transition:
Current State: Ready
Transition Condition:
Operator presses Start AND all interlocks satisfied.
New State: Production.
This logic ensures that the machine cannot start unless conditions are safe.
Handling State Transitions Safely
Transitions should always include safety checks.
For example:
The machine should not transition from Idle directly to Production.
Instead, it must first pass through Ready and Threading states.
This ensures that material is loaded correctly before production begins.
Reset and Fault Handling
State machines must also include fault handling logic.
When a fault occurs:
1 machine transitions to Fault state
2 machine stops safely
3 operator investigates problem
4 operator resets the system.
Once the fault is cleared, the machine may return to Idle or Ready.
State Indicators on the HMI
The HMI should display the current machine state clearly.
Operators should always know whether the machine is:
- idle
- running
- in threading mode
- in fault condition.
Clear state indicators reduce operator confusion.
Avoiding State Machine Programming Errors
Several mistakes can occur when designing PLC state machines.
Multiple Active States
The machine should only be in one state at a time.
Poor programming may allow multiple states simultaneously.
Missing Transition Conditions
Transitions without proper conditions may cause unpredictable machine behavior.
State Deadlocks
If transition conditions are incorrect, the machine may become stuck in a state.
Troubleshooting State Machine Problems
Technicians troubleshooting PLC programs should monitor the machine state variable.
Common checks include:
- verifying state transitions
- confirming sensor inputs
- checking transition conditions.
Watching the state variable in real time often reveals where the program is stuck.
Commissioning State Machine Programs
During machine commissioning, engineers should verify that the state machine works correctly.
Typical tests include:
1 verifying idle to ready transition
2 testing threading mode
3 running production cycles
4 simulating faults.
Testing ensures that the machine transitions correctly between states.
Preventative Maintenance for PLC Programs
Although PLC software does not wear out physically, periodic review improves reliability.
Recommended practices include:
- documenting state transitions
- updating HMI state indicators
- reviewing fault handling logic.
Well-maintained PLC programs remain easier to troubleshoot over time.
Benefits of State Machine Programming
State machine programming provides several important benefits.
These include:
- clearer PLC code structure
- easier troubleshooting
- safer machine operation
- scalable automation design.
Because of these advantages, state machines are widely used in modern roll forming control systems.
FAQ — PLC State Machines in Roll Forming
What is a state machine in PLC programming?
A state machine is a structured program where the machine operates in defined states such as idle, running, or fault.
Why are state machines useful in roll forming machines?
They organize machine sequences clearly and make PLC programs easier to troubleshoot.
Can multiple states be active at the same time?
No. In a proper state machine, the machine should only operate in one state at a time.
How does the PLC know when to change states?
The PLC checks transition conditions such as sensor signals or operator commands.
What happens when a machine fault occurs?
The PLC typically transitions to a fault state and stops machine operation.
Why should machine states be displayed on the HMI?
Displaying machine states helps operators understand the current machine condition and diagnose problems quickly.