Click the blue text to follow!
Quick Troubleshooting Design Patterns for Function Block Diagrams in PLC Process Control
A few days ago, Xiao Zhang rushed over from the workshop, sweating profusely: “Old Li, the production line 3 has stopped again, and the system is indicating a function block error. The management is pushing hard, what should we do?” Seeing him anxious like an ant on a hot pan, I smiled and said, “Don’t panic, I’ll teach you a few tricks, and you’ll be able to handle it yourself next time.”
Function blocks are the “helpers” in PLC programs, packaging complex control logic into a module that can be called directly when needed. But just like a wrench in a toolbox, using it correctly can yield great results, while using it incorrectly may strip the screws.
I remember last month during the night shift, the packaging line suddenly stopped. It turned out that the temperature control function block had incorrect parameter settings, leading to a false alarm. I spent two hours troubleshooting in the dark, and later summarized a set of methods, which I will share with you today.
Step One: Start with Input and Output. Function blocks are like black boxes; don’t rush to look inside. First, check if the “goods” at the input and output are correct. You can do this:
// Check function block input values
IF "Temperature_Sensor" > 100 THEN
#Error := 16#0001; // Sensor may be abnormal
RETURN;
END_IF;
A while ago, a young man was troubleshooting a fault, fixated on the internal logic of the function block, and after a long time, he couldn’t solve it. I told him to check the input signal, and to his surprise, the sensor wiring was loose, causing erratic values, which naturally led to errors in the function block!
Second Trick: Status Codes are the Key to Troubleshooting. Each function block outputs a status code when an error occurs, which is more direct than the management’s expressions, telling you where the problem lies. Most people’s first reaction upon receiving an error code is to check the manual, but experienced technicians have a little trick:
// Quick judgment of common status codes
CASE #StatusCode OF
16#8001: // Parameter out of range
16#8002: // Configuration error
16#8104: // Communication interrupted
END_CASE;
Take Siemens S7-300 for example, 8001 usually indicates a parameter issue, 8002 may indicate a configuration error, and 8104 is often a communication interruption. Remember these common ones to save time flipping through the manual.
When Xiao Wang maintained the equipment independently for the first time, he was sweating profusely when faced with error code 8104. I took a look and said with a smile, “It’s just a communication interruption, check if the network cable is loose.” He didn’t believe it, but it turned out the cable had been snagged by a forklift, and reconnecting it solved the problem.
Practical Tip: Use Simplified Mode for Quick Localization. When a large system has issues, don’t start with a full inspection. First, set the system to simplified mode and activate one function block at a time:
// Gradual activation in simplified mode
"FB_Temperature_Control".Enable := TRUE;
"FB_Pressure_Control".Enable := FALSE;
"FB_Flow_Control".Enable := FALSE;
This is like fixing a TV; first check if the power cable is connected, then check if the antenna is plugged in, and only then consider opening the machine. Step by step, the problem often lies in places you wouldn’t expect.
Once, the entire production line had alarms from seven or eight function blocks, and everyone was at a loss. I used simplified mode to activate only one flow control block and found that as soon as this block was activated, the system alarmed. Eventually, I discovered that the calibration parameters for the flow sensor were incorrect, and after correcting them, the entire line returned to normal.
Remember, the parameter configuration of function blocks is crucial. It’s like cooking rice; if the ratio of rice to water is correct, the rice will be fragrant. The regulator function block we use in our factory has a gain parameter (P) set too high, causing the system to react too aggressively; if set too low, it can’t keep up with changes. Generally, start with conservative values and adjust gradually.
Seemingly complex problems often have simple solutions. Many times, function block errors stem from three reasons: abnormal inputs, improper parameters, and communication issues. Mastering these three points can quickly pinpoint most faults.
Finally, a word for the young people: Don’t be afraid of function blocks; no matter how complex they are, they were designed by people. Get hands-on, make mistakes, and slowly you will be able to understand them as easily as reading a book.
Next time, we’ll talk about variable frequency drives, which is another interesting topic.