Share this

Ten methods for simulating input filtering in a PLC

2026-04-06 05:43:21 · · #1

1. Arithmetic Mean Filtering Method A. Method: Take N consecutive sample values ​​and perform an arithmetic mean operation. When N is large: signal smoothness is high, but sensitivity is low. When N is small: signal smoothness is low, but sensitivity is high. Selection of N value: Generally, for flow rate, N=12; for pressure: N=4. B. Advantages: Suitable for filtering signals with random interference. Such signals have an average value, and the signal fluctuates around a certain range. C. Disadvantages: Not suitable for real-time control with slow measurement speed or high data calculation speed requirements; relatively wasteful of RAM.

2. Median Filtering Method A. Method: Sample N times consecutively (N is an odd number), arrange the N sampled values ​​in order of magnitude, and take the median as the effective value. B. Advantages: Effectively overcomes fluctuations caused by random factors; has good filtering effect on measured parameters with slow changes in temperature and liquid level. C. Disadvantages: Not suitable for parameters with rapid changes such as flow rate and velocity.

3. Amplitude Limiting Filtering Method (also known as Program Judgment Filtering Method) A. Method: Based on experience, determine the maximum allowable deviation between two samples (let's call it A). Each time a new value is detected, determine: if the difference between the current value and the previous value is less than or equal to A, then the current value is valid; if the difference is greater than or equal to A, then the current value is invalid, discard it, and replace it with the previous value. B. Advantages: Effectively overcomes pulse interference caused by accidental factors. C. Disadvantages: Cannot suppress periodic interference; poor smoothness.

4. Median Average Filtering Method (also known as Anti-Pulse Interference Average Filtering Method) A. Method: Equivalent to "Median Filtering Method" + "Arithmetic Average Filtering Method". Continuously sample N data points, remove the maximum and minimum values, and then calculate the arithmetic mean of the N-2 data points. N value selection: 3~14 B. Advantages: Combines the advantages of two filtering methods. For occasional pulse interference, it can eliminate sampling value deviations caused by pulse interference. C. Disadvantages: Slow measurement speed, and like the arithmetic average filtering method, it wastes RAM.

5. Recursive Average Filtering Method (also known as Moving Average Filtering Method) A. Method: Treat N consecutive sampled values ​​as a queue with a fixed length of N. Each time a new data point is sampled, it is placed at the tail of the queue, and the previous data point at the head of the queue is discarded. (First-In, First-Out principle) The arithmetic mean of the N data points in the queue yields the new filtered result. Selection of N values: Flow rate, N=12; Pressure: N=4; Liquid level, N=4~12; Temperature, N=1~4 B. Advantages: Good suppression of periodic interference, high smoothness, suitable for high-frequency oscillating systems. C. Disadvantages: Low sensitivity, poor suppression of occasional pulse interference, difficult to eliminate sampling value deviation caused by pulse interference, unsuitable for situations with severe pulse interference, relatively wasteful of RAM.

6. Amplitude Limiting Averaging Filtering Method: A. Method: Equivalent to "amplitude limiting filtering" + "recursive averaging filtering". Each newly sampled data is first amplitude limited, then sent to the queue for recursive averaging filtering. B. Advantages: Combines the advantages of two filtering methods. For occasional pulse interference, it can eliminate sampling value deviations caused by pulse interference. C. Disadvantages: Relatively wasteful of RAM.

7. Weighted Recursive Average Filtering Method A. Method: An improvement on the recursive average filtering method, where data at different times are assigned different weights. Generally, data closer to the current time receives a larger weight. A larger weight coefficient for a new sample value results in higher sensitivity but lower signal smoothness. B. Advantages: Suitable for objects with large pure time delay constants and systems with short sampling periods. C. Disadvantages: For signals with small pure time delay constants, long sampling periods, and slow changes, it cannot quickly reflect the severity of the current interference to the system, resulting in poor filtering performance.

8. First-order hysteresis filtering method: A. Method: Take a = 0~1. Current filtering result = (1-a) * current sample value + a * previous filtering result. B. Advantages: Good suppression 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; cannot eliminate interference signals with a filtering frequency higher than 1/2 of the sampling frequency.

9. Debouncing Filtering Method A. Method: Set a filter counter to compare each sampled value with the current valid value: If the sampled value = the current valid value, the counter is reset to zero; if the sampled value << the current valid value, the counter is incremented by 1, and it is determined whether the counter >= the upper limit N (overflow). If the counter overflows, the current valid value is replaced by the current value, and the counter is reset. B. Advantages: It has a good filtering effect on slowly changing measured parameters and can avoid repeated on/off jumps of the controller or numerical jitter on the display near the critical value. C. Disadvantages: It is not suitable for rapidly changing parameters. If the value sampled at the time of counter overflow happens to be an interference value, the interference value will be imported into the system as a valid value.

10. Amplitude Limiting and De-jitter Filtering Method A. Method: Equivalent to "Amplitude Limiting Filtering" + "De-jitter Filtering," first limiting amplitude, then de-jittering. B. Advantages: Inherits the advantages of "Amplitude Limiting" and "De-jittering," improves upon some shortcomings of the "De-jitter Filtering," and avoids introducing interference values ​​into the system. C. Disadvantages: Not suitable for rapidly changing parameters.

Read next

CATDOLL 136CM Vivian (Customer Photos)

Height: 136cm Weight: 23.3kg Shoulder Width: 31cm Bust/Waist/Hip: 60/54/68cm Oral Depth: 3-5cm Vaginal Depth: 3-15cm An...

Articles 2026-02-22
CATDOLL 108CM Cici

CATDOLL 108CM Cici

Articles
2026-02-22