Depending on the nature and consequences of the interference, different software countermeasures are adopted, and there is no fixed pattern. For PLC real-time data acquisition systems, in order to eliminate interference signals in the sensor channels, active or passive RLC networks are often used in hardware to form analog filters for frequency filtering. Similarly, frequency filtering can also be achieved using the CPU's computing and control functions, performing similar functions to analog filters; this is digital filtering. Many monographs on digital signal processing discuss this in detail and can be consulted. With the increasing speed of computer processing, the application of digital filtering in real-time data acquisition systems will become increasingly widespread. In general data acquisition systems, some simple numerical and logical operations can be used to achieve the filtering effect. Several commonly used methods are introduced below.
1. Arithmetic Mean Method
For a single data point, multiple consecutive samples are taken, and their arithmetic mean is calculated. This average is then used as the sampling result for that point. This method can reduce the impact of random interference on the acquisition results. Generally, 3 to 5 averages are sufficient.
2. Comparison and selection method
When individual data points in the control system's measurement results contain deviations, a comparative selection method can be used to eliminate these erroneous data. This involves sampling each sampling point several times consecutively, and determining which data to accept or reject based on the changing patterns of the sampled data, thereby eliminating the erroneous data. For example , the "sample three, select two" method means sampling each sampling point three times consecutively, and selecting the two identical data points as the sampling result.
3. Median method
Depending on whether the sampling data is too large or too small due to interference, multiple signals are continuously collected for a sampling point, and these sampling values are compared. The median value is taken as the sampling result for that point.
4. First-order recursive digital filtering method
This method utilizes software to implement the algorithm for an RC low-pass filter, replacing the hardware RC filter with a software approach. The first-order recursive digital filtering formula is Yn = QXn + (1-Q)Yn-1
In the formula, Q represents the time constant of the digital filter.
Xn - the filter input at the nth sampling;
Yn - The filter output at the nth sampling.
Software filters can effectively eliminate errors in data acquisition. However, it is important to note that the choice of method should be based on the signal's variation patterns.