You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

---------->>>>>Get FREE PLC Programming Tips

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

PLC training tools sale

Reply
 
Thread Tools Display Modes
Old June 27th, 2012, 12:12 PM   #1
wildswing
Member
Canada

wildswing is offline
 
wildswing's Avatar
 
Join Date: May 2005
Location: Sault Ste Marie, Ontario
Posts: 258
AB 1734-IE8C Analog Input filter config question

Hey fellas,

I've got some Point I/O analog inputs (1734-IE8C) that I would like to filter. FYI, this is for some flow meters. The raw unfiltered input is a little too erratic for what I want to do with them. I know I can program my own filter, but I thought I'd try the module's built in filter first.

Can someone explain this filter. What type is it and what significance does the ms setting (0-10000) have?

Long shot here...Is there any way to see the raw unfiltered input AND the filter output at the same time to compare the two?

Thanks in advance. Your feedback is very much appreciated.
__________________
Mark
Hard work never killed anyone, but why take the chance?
  Reply With Quote
Old June 27th, 2012, 01:21 PM   #2
rguimond
Member
Canada

rguimond is offline
 
Join Date: Jul 2009
Location: Escuminac
Posts: 379
FV+((FV-AV)*0.xx) works well

FV = Filtered Value
AV = Actual Value
xx = some number from .99 to .01. Pick a number that works well for your application.

You could also read AV into a data table every so often and average the values in it. For instance, set up a timer that moves the AV to the start of a 10-word data table every second. The first time it's used, the data table has only one value. the next second, move the original data to the second word and put the new AV into the first word. Once you have accumulated ten words of data, add them all together and divide by ten.
__________________
"If you can't measure it, you can't manage it!"
  Reply With Quote
Old June 27th, 2012, 01:35 PM   #3
wildswing
Member
Canada

wildswing is offline
 
wildswing's Avatar
 
Join Date: May 2005
Location: Sault Ste Marie, Ontario
Posts: 258
Thanks for the quick reply.

I've used that same formula as well. Is that the formula the Point I/O config uses? Where does the millisecond setting come in?

I'm familiar with your 2nd example. I've done much the same using FIFO and Average blocks.
__________________
Mark
Hard work never killed anyone, but why take the chance?
  Reply With Quote
Old June 27th, 2012, 01:45 PM   #4
rguimond
Member
Canada

rguimond is offline
 
Join Date: Jul 2009
Location: Escuminac
Posts: 379
It's not really a "millisecond setting". The value is only a multiplier of the difference between the "real" value and the previous "filtered value".

For instance, if the first scan of the PLC returns a value of 10,000, the formula looks at the previous filtered valve (zero, on the first scan) and adds the difference between it and the actual value, times the multiplier. The bigger the multiplier, the less "filtering"
__________________
"If you can't measure it, you can't manage it!"
  Reply With Quote
Old June 27th, 2012, 02:03 PM   #5
Buzzen
Member
United States

Buzzen is offline
 
Join Date: Apr 2010
Location: stockton, ca
Posts: 95
Funny you've brought this up. I am going through the same thing as well, as far as having erratic readings. What did you end up doing to fix the problem. I have tried counters with an average to "mellow" out the signal still to erratic for a PID loop.
thanks
  Reply With Quote
Old June 27th, 2012, 02:12 PM   #6
rguimond
Member
Canada

rguimond is offline
 
Join Date: Jul 2009
Location: Escuminac
Posts: 379
Check for proper grounding of your analog sensors. Sometimes electrical noise is the problem. Can sometimes be corrected by grounding ONLY @ one end.
__________________
"If you can't measure it, you can't manage it!"
  Reply With Quote
Old June 28th, 2012, 05:52 AM   #7
wildswing
Member
Canada

wildswing is offline
 
wildswing's Avatar
 
Join Date: May 2005
Location: Sault Ste Marie, Ontario
Posts: 258
Quote:
Originally Posted by Buzzen View Post
What did you end up doing to fix the problem.
Nothing yet. I'm still just exploring filtering options.
__________________
Mark
Hard work never killed anyone, but why take the chance?
  Reply With Quote
Old June 28th, 2012, 06:20 AM   #8
wildswing
Member
Canada

wildswing is offline
 
wildswing's Avatar
 
Join Date: May 2005
Location: Sault Ste Marie, Ontario
Posts: 258
Not sure if it's OK to post something copied from Rockwell's KB, so Admins please delete if this is not allowed.

I just ran across this in the Rockwell KB, "42026 - How to do digital filtering in code?". I've asked tech support if this is the filter formula used 1734 IE8C digital filter.

Quote:
When using analog modules that have no or limited digital filtering in a noisy application or environment, it may be necessary to filter the signal in code to smooth the process and avoid overreaction (such as when the noisy signal is used as the PV of a PID).
To create a low band-pass filer in code, we first need a routine based on an interrupt (it must be repeated at very specific times and no dependant on a variable scan time) along with the standard digital filtering formula of:

y = (x(n) + y(n-1)) / ((2n) - 1)
*Where n is a constant, x is the live signal feedback (i.e. the analog data), and y is the filtered result.

If you implemented this in a system where x is already at some non-zero number, you will notice y will ramp up and eventually equal x, but with high-frequency oscillations damped out. The smaller the number n, the higher and more specific frequency that is attenuated. Making this a very large number (i.e. 1000, or 1 sec) would create a very low-pass filter sluggish response).

Example:
An analog signal comes in on Local:3:I.Ch0Data, and is very “jittery,” with lots of high-frequency noise. In ControlLogix/FlexLogix/CompactLogix I create a periodic task set at 100ms (or in SLC/MicroLogix and PLC-5 I create an STI at 100ms), and a new tag for the filtered signal called FilteredSignal.
I then code the rung using this CPT instruction:



This will then filter the analog signal and place the smoothed result in FilteredSignal, which is the tag I will use in my program in place of Local:3:I.Ch0Data. Optionally, the constants “1000,” “999” and “1999” used in the above example can be replaced with three integer tags, so that the first is a user-entered variable, the second is always calculated as the first entry minus one, and the last is a sum of the previous two. This way filter values can be changed programmatically, or via an HMI, to tailor signal response ‘on the fly.’
---
The filter response can then be varied by changing the divisors, with higher numbers yielding slower response. Decreasing the period of execution (i.e. the STI) will essentially slow the sample rate, also lowering the band-pass, at the cost of potentially losing some sample data. Combinations of the two can ultimately be tried to yield the desired result.
__________________
Mark
Hard work never killed anyone, but why take the chance?

Last edited by wildswing; June 28th, 2012 at 06:24 AM.
  Reply With Quote
Old June 28th, 2012, 05:05 PM   #9
kamenges
Member
United States

kamenges is offline
 
kamenges's Avatar
 
Join Date: Nov 2002
Location: Brillion, WI
Posts: 2,879
It's very likely just a simple first order low pass filter. The time value is a first order response time constant. If you apply a step input to the filter the output will reach appriximately 63% of the input value in one time constant. It will take 5 time constants to reach about 99% of the step input value. The output value will approach the input value in a decreasing slope curve.

An alternate version of the filter from post 2 is:

Y(n) = (Y(n-1) * K) + (X(n) * (1 - K))

where:
Y(n) is Filter Output
Y(n-1) is Last Scan Filter Output
K is Filter Constant ( between 0 and 1)
X(n) Filter Input

K is calculated as:
e-(t/T)
where:
e is the base of the natural log (about 2.718)
t is the processor scan time in seconds
T is the filter time constant in seconds

That is how you can convert a given time constant into a usable filter constant.
Also, the -3dB frequency of the filter is at 1/T in radians per second. So now you can correlate the time constant to a frequency.

Keith
  Reply With Quote
Old June 29th, 2012, 06:17 AM   #10
wildswing
Member
Canada

wildswing is offline
 
wildswing's Avatar
 
Join Date: May 2005
Location: Sault Ste Marie, Ontario
Posts: 258
Thanks Keith.

I ended up just using the module's filter rather than rolling my own. Seems to work fine for what I need.

Thanks for the feedback fellas. As I mentioned before, it's very much appreciated.
__________________
Mark
Hard work never killed anyone, but why take the chance?
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Topics
Thread Thread Starter Forum Replies Last Post
Need help with config of 1734 IO over CNet wildswing LIVE PLC Questions And Answers 6 November 14th, 2011 02:42 PM
S7-200 and analog input problem mniknezhadi LIVE PLC Questions And Answers 3 July 31st, 2008 03:33 AM
Micrologix 1200 Input filter Preeya LIVE PLC Questions And Answers 2 April 14th, 2004 09:42 AM
AB Compactlogix with analog output question!! 93lt1 LIVE PLC Questions And Answers 5 August 21st, 2002 12:09 PM
AB Analog Input Module Wiring... Eric Nelson LIVE PLC Questions And Answers 3 May 6th, 2002 08:37 AM


All times are GMT -5. The time now is 04:06 PM.


.