Digital filtering is often used in AD acquisition, and there are different filtering requirements in different situations. The following are the programs and advantages and disadvantages of 10 classic software filtering methods:

1. Limiting filtering method (also known as program judgment filtering method)

2, the median value filtering method

3. Arithmetic average filtering method

4, recursive average filtering method (also known as sliding average filtering method)

5, the median average filtering method (also known as anti-pulse interference average filtering method)

6. Limiting average filtering method

7. First-order lag filtering method

8. Weighted recursive average filtering method

9, debounce filtering method

10. Limiting debounce filtering method

1, limited secondary filtering

A, method:

According to experience, determine the maximum deviation allowed for two samplings (set to A)

Determine each time a new value is detected:

If the difference between this value and the previous value is "=A, then this value is valid.

If the difference between this value and the previous value is "A", the current value is invalid, the current value is discarded, and the current value is used instead of the current value.

B, advantages:

Can effectively overcome the pulse interference caused by accidental factors

C, shortcomings

Unable to suppress that kind of periodic interference

Poor smoothness

program:

/* A value can be adjusted according to actual conditions

Value is a valid value, new_value is the current sample value

The filter returns a valid actual value*/

#define A 10

Char value;

Char filter()

{

Char new_value;

New_value = get_ad();

If ( ( new_value - value 》 A ) || ( value - new_value 》 A ) )

Return value;

Else

Return new_value;

}

2, the median value filtering method

A, method:

Continuously sample N times (N takes an odd number), arrange the N sample values ​​by size, and take the middle value as the current effective value.

B, advantages:

It can effectively overcome the fluctuation interference caused by accidental factors, and has a good filtering effect on the measured parameters with slow changes in temperature and liquid level.

C, disadvantages:

It is not suitable for parameters such as flow rate and speed that change rapidly.

program:

/* N value can be adjusted according to the actual situation

Sorting using bubbling method*/

#define N 11

Char filter()

{

Charvalue_buf[N];

Char count,i,j,temp;

For ( count=0;count"N;count++)

{

Value_buf[count] = get_ad();

Delay();

}

For(j=0;j"N-1;j++)

{

For(i=0;i"Nj-1;i++)

{

If ( value_buf "value_buf[i+1] )

{

Temp =value_buf;

Value_buf = value_buf[i+1];

Value_buf[i+1] = temp;

}

}

}

Returnvalue_buf[(N-1)/2];

}

3. Arithmetic average filtering method

A, method:

Continuously take N sample values ​​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 flow, N=12; pressure: N=4

B, advantages:

Suitable for filtering signals that generally have random interference

The characteristic of such a signal is that there is an average value, and the signal fluctuates around a certain range of values.

C, disadvantages:

Not applicable to real-time control with slower measurement speed or faster data calculation speed

Worried RAM

program:

#define N 12

Char filter()

{

Int sum = 0;

For ( count=0;count"N;count++)

{

Sum + =get_ad();

Delay();

}

Return (char)(sum/N);

}

4, recursive average filtering method (also known as sliding average filtering method) (FIR predecessor)

A, method:

Treat N consecutive samples as a queue

The length of the queue is fixed to N

Each time a new data is sampled, it is put into the end of the team, and the data of the original team leader is discarded. (first in, first out principle)

By performing arithmetic averaging on the N data in the queue, a new filtering result can be obtained.

Selection of N value: 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

System for high frequency oscillation

C, disadvantages:

Low sensitivity

Poor inhibition of occasional impulsive interference

It is not easy to eliminate the deviation of sample values ​​caused by pulse interference

Not suitable for occasions where pulse interference is serious

Worried RAM

program:

#define N 12

Char value_buf[N];

Char i=0;

Char filter()

{

Char count;

Int sum=0;

Value_buf[i++] = get_ad();

If ( i == N ) i = 0;

For ( count=0;count "N,count++"

Sum+ = value_buf[count];

Return (char)(sum/N);

}

ATV930 Series Inverter

Altivar Process ATV900 Drives with embedded services, high performance motor control, safety and application functionality to meet demanding applications including conveyors, cranes, mills and more in the Process Industry. Ideal for segments such as Mining & Metals, Oil & Gas, Food & Beverage and Hoisting. From 0.75kW to 1200kW.

3 Phase Inverter Duty Motor,Frequency Inverter Circuit,Inverter In Ac Drive,Frequency Converter High Power

Wuxi Trenty Machinery & Equipment Co., Ltd. , https://www.elec-inverter.com