PLC Analog Signal Filtering: Signal Processing Algorithms to Eliminate Data Noise!

“PLC Analog Filtering: 3 Key Techniques to Tame Data Noise, Making Equipment Stable Like a Rock!”

PLC Analog Signal Filtering: Signal Processing Algorithms to Eliminate Data Noise!

Hello everyone! Today, let’s talk about the most frustrating issue in industrial sites: the sudden fluctuations of analog signals! Just look at this data curve, shaking more vigorously than a square dance aunt, and the equipment often malfunctions, raising your blood pressure, right? (Here should be a soul-searching question: whose PLC has not been troubled by noise? Raise your hand and let me see!)

▶ Bloody Lessons

Last month, I personally witnessed three “tragedies”:

1️⃣ In a chemical plant, the level gauge signal suddenly spiked, and the valve fully opened, directly performing a “man-made fountain show”, resulting in a 48-hour production halt, costing enough to buy a BMW 5 Series!

2️⃣ On the automotive production line, the pressure sensor went haywire, causing the robot to “dance awkwardly” and crash three machines, with repair costs equivalent to three years’ worth of screws in the workshop!

3️⃣ The most outrageous was at a water treatment station, where pH signal drift caused the dosing pump to go crazy, turning the sedimentation tank into a “cement sculpture”…

▍ Noise-Killing Techniques

Filtering is like giving a PLC a massage; you need to find the right pressure points! Here comes the good stuff!

First Technique: Lifesaver for the Lazy — The Built-in “Fool’s Filter” in TIA Portal

(Keyboard warriors, hold your fire! This newbie technique must come first!)

Just check the “Moving Average” in the configuration, set a 50ms delay, and you’re done in 5 minutes! The effect? Well, it’s enough to deal with ordinary workshop interference! But if you encounter a frequency converter, this method is like using a newspaper to block bullets — purely psychological comfort! (Here should be self-deprecation: Don’t ask me how I know, too much to say…)

Second Technique: Exclusive for Experienced Users — First-Order Lag Filtering Algorithm

The formula is just one line: Y=0.2 new data + 0.8 previous result

This thing is like putting speed bumps on the signal, instantly turning wild data into a gentle lamb! I’ve even written the SCL code for you; just copy and paste! But be careful, if you increase the filtering coefficient too much, the signal may become “senile”, and if you decrease it, it won’t suppress the noise. You need to find the right balance! (Note: It’s recommended to start with a coefficient of 0.2-0.3!)

Third Technique: The Ultimate Combo — Sliding Window + Extreme Value Filtering

PLC Analog Signal Filtering: Signal Processing Algorithms to Eliminate Data Noise!

Create an array to store the last 10 data points, discard the highest and lowest values, and calculate the average of the rest! This technique is perfect for dealing with all kinds of “outlier data”, much like a homeroom teacher handling fighting students — first, take the troublemakers out! The code involves a for loop with if statements, which looks complex, but you can use it by just changing three variable names according to the template!

▶ Pitfall Guide (Tearful Compilation)

❗ Never use strong filtering on flow meters! By the time the filtering is done, the pipeline will have overflowed!

❗ If the grounding resistance exceeds 4Ω, rectify it immediately! No filtering algorithm can save a “scattershot” grounding!

❗ If you encounter 485 signal fluctuations, first check the terminal resistance! This is a thousand times more effective than any algorithm!

▍ Real-World Results Speak

Data from a certain electronics factory:

(See? Spending an extra 600 yuan on spare parts saved a loss of 58,000 yuan from production downtime! Even elementary school students can calculate this!)

▶ Benefits for the Lazy

Follow these three steps:

1️⃣ Use the built-in filter for devices with low interference

2️⃣ Apply the first-order lag algorithm for critical parameters

3️⃣ Use sliding extreme value filtering for extreme conditions

If you still can’t solve it… come on, shout “Zhang, help me!” in the comments, and I’ll send you the electronic secret manual “Eighteen Techniques for Industrial Signal Noise Reduction”!

Finally, let me leave you with a golden saying: If the filtering is done well, you can get off work early; if the algorithm is used smoothly, you’ll get bonuses that make your hands cramp! See you in the comments! (Gotta go, the production line is alarming again…)

Leave a Comment