Click the blue text to follow!
Cost Reduction Practices of PLC State Diagrams in Safety Control
Last week, the automated packaging line at Xiao Zhang’s factory had another issue. In a hurry, they called me to take a look, saying that the safety protection kept malfunctioning, causing downtime three to four times a day, with each stoppage costing several thousand. When I arrived on-site, I couldn’t help but laugh—this was a classic case of poor state control!
Honestly, I’ve been in this industry for over ten years and have seen too many factories skimp on their safety systems to save money, only to end up spending more on repairs. Today, I will share practical experiences on how to use PLC state diagrams to ensure safety while saving costs.
The core of safety control is state management, which many newcomers do not understand. They think that adding a few emergency stop buttons and installing more safety light curtains is sufficient. Little do they know that without good state management, safety devices can actually increase the frequency of false activations, affecting production efficiency.
I remember when I first encountered state diagrams, I was also confused. What are states S0, S1, S2, and the conditions for state transitions? It sounded quite complicated. In fact, it’s a simple analogy—state diagrams are like elevator controls; the elevator can be at different floors (states), and pressing a button (trigger condition) will move it from one floor to another (state transition).
The issue at Xiao Zhang’s factory was a typical case of not understanding the conditions for state transitions. The equipment had four basic states: running, stopped, fault, and maintenance, but the state transition conditions in the program were written chaotically, leading to frequent misjudgments of entering the fault state.
A good PLC state diagram program should first define clear state codes. I usually write it like this:
#define STATE_STOP 0 // Stopped state
#define STATE_RUN 1 // Running state
#define STATE_FAULT 2 // Fault state
#define STATE_MAINT 3 // Maintenance state
Next, the state transition logic must be clear. I modified Xiao Zhang’s program, and the core was just these few lines:
IF (Current_State == STATE_RUN) AND (Emergency_Stop OR Safety_Gate_Open) THEN
Current_State := STATE_FAULT;
Alarm_Code := 101;
ELSIF (Current_State == STATE_FAULT) AND Reset_Button AND NOT Safety_Gate_Open THEN
Current_State := STATE_STOP;
END_IF;
As you can see, the conditions must be clearly defined, specifying under what circumstances to transition to which state. Many people fail at this step, causing the equipment to jump states erratically.
So, how can state diagrams help us save money? In this regard, I must mention a case I personally experienced.
The year before last, I took on a project at a chemical plant. They originally planned to install over 30 safety relays, each costing two to three thousand, totaling over a hundred thousand. After redesigning with PLC state diagrams, I only used 8 safety relays, along with a complete state monitoring system, reducing the total cost by over 60% compared to the original plan.
Reasonable safety level differentiation can significantly reduce costs. Many people do not understand and make all areas the highest safety level, which is a waste! According to ISO 13849-1 standards, different hazardous areas can be classified into different PLa to PLe levels, and low-risk areas can use regular I/O without the need for all safety I/O.
The state diagram I designed for Xiao Zhang’s factory is as follows: the packaging line is divided into three areas, with the high-risk area using a safety PLC, the medium-risk area using safety I/O modules with a regular PLC, and the low-risk area using regular I/O directly. The states between the areas have interlocking relationships but are independently controlled.
The key to this approach is that the interlocking between states must have a buffering mechanism. For example, if the high-risk area enters a fault state, it does not necessarily mean that the low-risk area must stop immediately; it can allow the low-risk area to complete the current cycle before stopping. This improvement can increase production by several hundred pieces per day!
The code implementation is not complicated:
// Area interlocking control with buffering
IF (Zone_A_State == STATE_FAULT) THEN
IF Zone_B_Cycle_Complete THEN
Zone_B_State := STATE_STOP;
ELSE
Zone_B_Complete_Current_Cycle := TRUE;
END_IF;
END_IF;
Many people focus only on the shutdown conditions in safety control, neglecting the recovery conditions. This is also a place where costs are wasted. A reasonable recovery process can greatly reduce downtime. I added a semi-automatic recovery function for Xiao Zhang’s factory; after the operator confirms safety, they press the recovery button, and the system automatically checks the conditions. If met, it automatically resumes production without needing to call a maintenance worker to reset it.
Finally, recording the history of state transitions is also very important. I added a simple state log that records every state change, including timestamps and trigger conditions. This way, if an issue arises, the cause can be identified in minutes, saving a lot of troubleshooting time.
After the renovation at Xiao Zhang’s factory, false stoppages decreased from 3-4 times a day to less than once a week, saving nearly a hundred thousand a month. The key is that safety has actually improved because the system is more reliable, and workers trust the system more, no longer secretly bypassing safety devices as they did before.
Ultimately, PLC state diagrams are not difficult; the challenge lies in integrating theory with the field. The next time you encounter a safety control project, don’t just think about adding equipment; first consider whether state management is done well. A well-designed state diagram can make your system both safe and cost-effective—why not take advantage of that?
Xiao Wang, remember, a good safety system is not necessarily the more complex, but rather one that is both safe and efficient!