First Order Filter

learner

Lifetime Supporting Member
Join Date
Apr 2007
Location
British Columbia
Posts
81
Hi Guys,

I have a WATT Transmitter which is giving me a very noisy signal. I would like to create a First Order Filter in my RSLOGIX 5000 ladder logic. The problem is that I have no clue how to even start thinking about such a thing in PLC logic. Could you please give some hints or a model?

the very learner

Regards:)
 
The form I typically use is:

Y0 = (Y-1 * Kf) + (X * (1 - Kf))

where:

Y0 is the filtered output

Y-1 is the filtered output from the previous scan

X is the input to be filtered

Kf is the first order filter constant

Kf = e-t/T

where"

t is the time between scans

T is the first order time constant



Or, if you have the FBD programming add-on there is a first order filter block included in that.

Keith
 
Or something simple

FV=FV+C(NV-FV)
Where:
FV= Filtered value
C= constant (range 0-1) The smaller the number the more dampening.
NV= New Value

PictureFilteredValue.jpg
 
I would agree with Alaric about using the built-in functions, although I didn't realize ST had a built-in function call for a first order filter.

However, on a side note, if you do the algebra you find that Micky's filter equation and my equation are effectively the same. The difference is that Micky's C constant is equal to 1-Kf from my equation. If you look long enough you will find other equivalent forms. They are basically all digital implementations of a differnce equation.

Keith
 
I am still laughing

kamenges said:
I would agree with Alaric about using the built-in functions, although I didn't realize ST had a built-in function call for a first order filter.
It isn't part of the language or specification so y'all ( I don't want to be mistaken for Prince Charles ) can't count on it being available in all implementations of ST. It is so easy to roll your own. The responses to this question are good. Is anybody ready for the next step?

How about a two pole Butterworth filter? Implementing a Butterworth filter is just a little more work but the filtering is so much better.
 
learner said:
I would like to create a First Order Filter in my RSLOGIX 5000 ladder logic

Why do it in logic?

First-Order lag filtering is available, per channel, on the Analog Input modules.

It can be set with a time-constant from 1 to 20,100 mS (20.1 Secs).

To use it (and the on-board scaling and alarming features), the data format of the Analog Input module must be set to "Float Data" when adding it to the I/O configuration tree.
 
Hmm, in the other thread, Peter demonstrated Butteworth filter in his Mathcad script.
I'm interested too. Is this all about implementation in specific PLC?
 
Last edited:
My maths isn't what it used to be but I would guess that a starting point would be that A1 + A2 + B0 = 1.

I also assume that the frequency of carrying out the calculation would also have a significant impact on the effectiveness of the filter - too short a time period and the filter will be ineffective as the signal may not change significantly in such a short period of time - too long and the filter will flatten everything and filter out real changes to the signal not just noise.

I'm guessing that some kind of model of the process is required but this is where I struggle with my maths; is there a way of determining values from observation?
 
You have a good feel for this...

burnerman said:
My maths isn't what it used to be but I would guess that a starting point would be that A1 + A2 + B0 = 1.
Yes

I also assume that the frequency of carrying out the calculation would also have a significant impact on the effectiveness of the filter - too short a time period and the filter will be ineffective as the signal may not change significantly in such a short period of time - too long and the filter will flatten everything and filter out real changes to the signal not just noise.
There are two parameters just like the first order filter. One it the frequency ( inverse time constant ) and the sample time.

I'm guessing that some kind of model of the process is required but this is where I struggle with my maths; is there a way of determining values from observation?
I am going to try to simplify this as much as possible. You will need to use formulas to calculate the coefficients using the sample time and the cut off frequency. Normally the sample time is determined by available hardware or interrupt routine. Then you adjust the cut off frequency to some were between the frequencies you need and the frequencies you want to filter out. This isn't any different that using the simple low pass filter.

So why bother? The noise above the cut off frequency is attenuated at -40 db per decade instead of -20 db per decade for a first order filter and the cut off between between the high and low frequencies is much sharper. Some people call the cut off frequency the corner frequency. The corners are sharper for the second order Butterworth filter. It is Monday morning here. Give me a few hours. I need to work too.
 

Similar Topics

Afternoon all, I'm working on setting up a large excel recipe table for porting updates through the Linx Gateway RTD/DDE function into my recipe...
Replies
2
Views
110
We are trying to poll data coming from a PLC for remote monitoring we have the IP address of the PLC and the default port number and the path is...
Replies
25
Views
568
Good morning. I'm doing a rehab and I need to recycle some part of the old code that won't change and that I need. This is a calculation that...
Replies
22
Views
1,357
Hello, I have been looking for a reference for the order that a UDT is copied in the COP instruction. More specifically - I have a set of code...
Replies
5
Views
546
Hello all, I got a session with the network guys that never deals with Profinet before. One of a comment to me was "can you make it not scan the...
Replies
5
Views
1,018
Back
Top Bottom