At present, the main methods used for mathematical filtering are:
1, limiting filtering method (also called program judgment filtering method)
A. Methods:
According to the empirical judgment, determine the maximum allowable deviation value of two sampling (set as a).
Judge every time a new value is detected:
If the difference between this value and the previous value
If the difference between this value and the previous value is >; A, the current value is invalid, the current value is abandoned, and the last value is used instead.
B, advantages:
It can effectively overcome the pulse interference caused by accidental factors.
C, shortcomings
Periodic interference cannot be suppressed.
Smoothness difference
2. Median filtering method
A. Methods:
Continuous sampling n times (n is odd)
Arrange the values sampled n times according to their size.
This time, take the middle value as a valid value.
B, advantages:
It can effectively overcome the fluctuation interference caused by accidental factors.
It has a good filtering effect on the measured parameters with slow temperature and liquid level changes.
C. disadvantages:
Not suitable for occasions where parameters such as flow and speed change rapidly.
3. Arithmetic average filtering method
A. Methods:
Take n samples continuously for arithmetic average operation.
When the value of n is large, the signal smoothness is high, but the sensitivity is low.
When the value of n is small, the signal smoothness is low, but the sensitivity is high.
Selection of n value: general process, n =12; Pressure: N=4
B, advantages:
It is suitable for filtering signals with random interference.
Such a signal is characterized by an average value, and the signal fluctuates up and down around a certain numerical range.
C, shortcomings
It is not suitable for real-time control with slow measurement speed or fast data calculation speed.
It wastes memory.
4. Recursive average filtering method (also called moving average filtering method)
A. Methods:
Take n samples continuously as a queue.
The length of the queue is fixed at n
Sample a new data at a time, put it at the end of the queue, and discard the original data at the head of the queue. (first-in, first-out principle)
A new filtering result can be obtained by performing arithmetic average operation on N data in the queue.
Selection of n value: flow, n =12; Pressure: n = 4;; Liquid level, n = 4 ~12; Temperature, N= 1~4
B, advantages:
It has good suppression effect on periodic interference and high smoothness.
System suitable for high frequency oscillation
C. disadvantages:
Low sensitivity
The suppression effect of occasional pulse interference is poor.
It is not easy to eliminate the sampling value deviation caused by pulse interference.
Not suitable for occasions with serious pulse interference.
It wastes memory.
5, median average filtering method (also known as anti-impulse interference average filtering method)
A. Methods:
Equivalent to "median filtering method"+"arithmetic average filtering method"
N data are sampled continuously, and the maximum and minimum values are removed.
Then calculate the arithmetic average of N-2 data.
N value selection: 3~ 14
B, advantages:
The advantages of the two filtering methods are combined.
For occasional pulse interference, the sampling value deviation caused by pulse interference can be eliminated.
C. disadvantages:
The measurement speed is slow, just like the arithmetic average filtering method.
It wastes memory.
6. Limit average filtering method
A. Methods:
Equivalent to "limit filtering method"+"recursive average filtering method"
Every time new data is sampled, it is restricted first.
Then send it to the queue for recursive average filtering.
B, advantages:
The advantages of the two filtering methods are combined.
For occasional pulse interference, the sampling value deviation caused by pulse interference can be eliminated.
C. disadvantages:
It wastes memory.
7. First-order lag filtering method
A. Methods:
Let a=0~ 1
This filtering result =( 1-a)* this sampling value +a* last filtering result.
B, advantages:
It has a good inhibitory effect on periodic interference.
Suitable for occasions with high fluctuation frequency.
C. disadvantages:
Phase lag, low sensitivity
The degree of lag depends on the value of a.
Interference signals with filtering frequency higher than 1/2 sampling frequency cannot be eliminated.
8. Weighted recursive average filtering method
A. Methods:
It is an improvement of recursive average filtering method, that is, different weights are given to the data at different times.
Usually, the closer to the current data, the greater the weight gain.
The greater the weight coefficient given to the new sampling value, the higher the sensitivity, but the lower the signal smoothness.
B, advantages:
It is suitable for objects with large pure lag time constant.
And the sampling period is shorter.
C. disadvantages:
For signals with small pure lag time constant, long sampling period and slow change.
It can't quickly reflect the current interference severity of the system, and the filtering effect is poor.
9. Jitter filtering method
A. Methods:
Set the filter counter.
Compare each sampled value with the current effective value:
If the sampling value = the current effective value, the counter is cleared.
If the sample value: = upper limit n (overflow)
If the counter overflows, the current valid value will be replaced by this value and the counter will be cleared.
B, advantages:
It has a good filtering effect on slowly changing measurement parameters,
Repeated on/off jumps of the controller near the critical value or digital jitter on the display can be avoided.