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 December 9th, 2016, 04:48 PM   #1
the_msp
Lifetime Supporting Member
United Kingdom

the_msp is offline
 
the_msp's Avatar
 
Join Date: May 2008
Location: Northern Ireland
Posts: 668
Filter analog input Logix5000

I have a 4-20 ultrasonic sensor on an oil tank. I am getting spikes that I would like to get rid of.

Quote:
Originally Posted by Mickey View Post
You could try a filter:

FV=FV+C(NV-FV)
Where:
FV= Filtered value
C= constant (range 0-1) The smaller the number the more dampening.
NV= New Value
Have tried this but I get 1.#QNAN.

V18, no logic preceeding what you see.

Searching the forum there was a suggestion to add the filter in the module properties. To do this the data format must be changed when adding the input module to the IO tree. Tried this but my only option in the drop down is "integer". Series C rev 3-1 1734-Ie2C.

Can someone tell me where I am going wrong.

Edit: spotted a typo in that CPT, have changed to "FV+C*(NV-FV)" - same result
Attached Images
File Type: png spikes.png (31.0 KB, 49 views)
File Type: jpg logic.jpg (22.6 KB, 61 views)
__________________
Regards,

Patrick

https://www.youtube.com/user/MrMatrixEngineering

Last edited by the_msp; December 9th, 2016 at 04:50 PM.
  Reply With Quote
Old December 9th, 2016, 05:00 PM   #2
OkiePC
Lifetime Supporting Member
United States

OkiePC is offline
 
OkiePC's Avatar
 
Join Date: Mar 2005
Location: ENE of Nowhere Oklahoma
Posts: 9,836
Hmmm. I use that filter logic all the time in Micrologix1400 controllers. Could it be a problem to have two references to the destination of the CPT instruction embedded within the expression?

With CPT instructions, when I run into problems, sometimes I will break it down into individual math instructions with separate scratch registers to carry from one to the next so I can see where things are failing apart.
__________________
It's not all the variables I am most concerned with, it's the undiscovered constants.
  Reply With Quote
Old December 9th, 2016, 05:03 PM   #3
the_msp
Lifetime Supporting Member
United Kingdom

the_msp is offline
 
the_msp's Avatar
 
Join Date: May 2008
Location: Northern Ireland
Posts: 668
It works for Mickey, at least I think it does (no online values showing in image) http://www.plctalk.net/qanda/showpost.php?p=298656&postcount=4
__________________
Regards,

Patrick

https://www.youtube.com/user/MrMatrixEngineering
  Reply With Quote
Old December 9th, 2016, 05:09 PM   #4
OkiePC
Lifetime Supporting Member
United States

OkiePC is offline
 
OkiePC's Avatar
 
Join Date: Mar 2005
Location: ENE of Nowhere Oklahoma
Posts: 9,836
Quote:
Originally Posted by the_msp View Post
It works for Mickey, at least I think it does (no online values showing in image) http://www.plctalk.net/qanda/showpost.php?p=298656&postcount=4
Looks like his screenshot is offline, but I don't see any reason it shouldn't work.

Your screen shot suggests an invalid result is somehow being generated, but the values appear to be valid going into the CPT block. Is it possible that some other code is blowing up one of these tags?
__________________
It's not all the variables I am most concerned with, it's the undiscovered constants.
  Reply With Quote
Old December 9th, 2016, 06:12 PM   #5
the_msp
Lifetime Supporting Member
United Kingdom

the_msp is offline
 
the_msp's Avatar
 
Join Date: May 2008
Location: Northern Ireland
Posts: 668
Shouldn't be - I created these tags just for this and aren't being used anywhere else
__________________
Regards,

Patrick

https://www.youtube.com/user/MrMatrixEngineering
  Reply With Quote
Old December 9th, 2016, 06:15 PM   #6
robertmee
Member
United States

robertmee is offline
 
robertmee's Avatar
 
Join Date: Feb 2008
Location: NC
Posts: 1,428
I just had to do this for several ultrasonic level sensors....I used the Low Pass Filter Function block in RSLogix5000 and it worked like a champ. I think I ended up with a 2nd order filter with pretty low gain and it steadied the signal out nicely.

In regards to your equation, is FV declared as a REAL or DINT? If DINT and truncated, I can see the equation quickly exceeding the max a 32 bit DINT can hold because you'll always be adding a small amount.

Last edited by robertmee; December 9th, 2016 at 06:27 PM.
  Reply With Quote
Old December 9th, 2016, 06:56 PM   #7
the_msp
Lifetime Supporting Member
United Kingdom

the_msp is offline
 
the_msp's Avatar
 
Join Date: May 2008
Location: Northern Ireland
Posts: 668
All tags are REAL.

I didn't attempt the FBD as I'm using Lite version of L5k and thought it could only do LAD, however I just had a go and it seems to be working. Currently just using 1st order. What parameter in the LPF is the constant?

Now just to wait on a spike...

Still keen to know why the LAD attempt doesn't work
__________________
Regards,

Patrick

https://www.youtube.com/user/MrMatrixEngineering
  Reply With Quote
Old December 9th, 2016, 07:08 PM   #8
robertmee
Member
United States

robertmee is offline
 
robertmee's Avatar
 
Join Date: Feb 2008
Location: NC
Posts: 1,428
Quote:
Originally Posted by the_msp View Post
All tags are REAL.

I didn't attempt the FBD as I'm using Lite version of L5k and thought it could only do LAD, however I just had a go and it seems to be working. Currently just using 1st order. What parameter in the LPF is the constant?

Now just to wait on a spike...

Still keen to know why the LAD attempt doesn't work
Wlag
  Reply With Quote
Old December 9th, 2016, 07:21 PM   #9
robertmee
Member
United States

robertmee is offline
 
robertmee's Avatar
 
Join Date: Feb 2008
Location: NC
Posts: 1,428
Quote:
Originally Posted by the_msp View Post
All tags are REAL.

I didn't attempt the FBD as I'm using Lite version of L5k and thought it could only do LAD, however I just had a go and it seems to be working. Currently just using 1st order. What parameter in the LPF is the constant?

Now just to wait on a spike...

Still keen to know why the LAD attempt doesn't work
Have you tried zeroing it after you corrected everything? Since it's an accumulated value, once it reached an invalid value (either divide by 0 or exceeded the tag type numerical limit), it would stay invalid since it adds to itself.
  Reply With Quote
Old December 9th, 2016, 07:56 PM   #10
the_msp
Lifetime Supporting Member
United Kingdom

the_msp is offline
 
the_msp's Avatar
 
Join Date: May 2008
Location: Northern Ireland
Posts: 668
Good idea - it worked!

I'll have a play with C and see if it can filter, the FBD I tried 2nd order with wlag at 1, 10, 100 (http://www.plctalk.net/qanda/showthr...highlight=wlag) - FV still jumps with NV.
__________________
Regards,

Patrick

https://www.youtube.com/user/MrMatrixEngineering
  Reply With Quote
Old December 9th, 2016, 08:21 PM   #11
the_msp
Lifetime Supporting Member
United Kingdom

the_msp is offline
 
the_msp's Avatar
 
Join Date: May 2008
Location: Northern Ireland
Posts: 668
FBD Wlag at 100, C in LAD at 0.1

I think the reason it isn't filtering is the spike lasts for several seconds?
Attached Images
File Type: png spike filter.png (14.8 KB, 184 views)
__________________
Regards,

Patrick

https://www.youtube.com/user/MrMatrixEngineering
  Reply With Quote
Old December 9th, 2016, 10:27 PM   #12
Bit_Bucket_07
Member
United States

Bit_Bucket_07 is offline
 
Bit_Bucket_07's Avatar
 
Join Date: Feb 2013
Location: Southeast US
Posts: 1,403
Quote:
Originally Posted by the_msp View Post
FBD Wlag at 100, C in LAD at 0.1

I think the reason it isn't filtering is the spike lasts for several seconds?
I once encountered a situation in which keying the mic on a walkie talkie in a certain location caused a spike like that in a thermocouple temperature reading, which would lead to an equipment shutdown.

Until I could replace the thermocouple transmitter, I instituted a software patch that detected a sudden rise in temperature and would ignore the input and hold the last valid value until the spike subsided. It had a watchdog timeout in case the temperature actually increased.

Of course, that was a software patch for a hardware problem, and I generally don't recommend employing such patches.
__________________
  Reply With Quote
Old December 11th, 2016, 11:31 PM   #13
sparkie
Lifetime Supporting Member
United States

sparkie is online now
 
Join Date: Nov 2014
Location: KS
Posts: 748
I once did an audiovisual alarm system on a cabinet wash in a meat processing facility. If the water temperature fell out of a certain range, it would either give a warning indicator, and if it had to stop the line it would also have an audio indicator.

What we found was that when a certain valve shifted, there would be a temperature spike, and when it closed there would be a sudden drop. This was for about 1.5 seconds, but it was enough to cause problems.

Rather than filter I put in a debounce timer for 5 seconds to detect the condition.
  Reply With Quote
Old December 11th, 2016, 11:40 PM   #14
Mickey
Lifetime Supporting Member
United States

Mickey is offline
 
Mickey's Avatar
 
Join Date: May 2003
Location: Palmdale,Ca
Posts: 10,119
Quote:
Originally Posted by Bit_Bucket_07 View Post
I once encountered a situation in which keying the mic on a walkie talkie in a certain location caused a spike like that in a thermocouple temperature reading, which would lead to an equipment shutdown.
Back in the 70's a coworker had a pace-maker, you could not use a walkie talkie around him. It would cause personal shutdown.
__________________
Mickey

If you want happiness for an hour-take a nap. If you want happiness for a day-go fishing. If you want happiness for a month-getmarried. If you want happiness for a year-inherit a fortune. If you want happiness for a lifetime-help someone else.
----- Chinese Proverb
  Reply With Quote
Old December 12th, 2016, 05:57 AM   #15
Ron Beaufort
Lifetime Supporting Member
United States

Ron Beaufort is offline
 
Ron Beaufort's Avatar
 
Join Date: Jul 2002
Location: Charleston, SC
Posts: 5,436
in taking a look at the figure that you gave us in your Post #9 (reproduced below) it seems like the disturbance that you're seeing is more like a "bump" which lasts quite some substantial amount of time rather than just a very quick "spike" ... (I couldn't find the "time units" on your graph being specified) ...

so (as you've already discovered) a normal "Filter" approach isn't likely to do you any good ... the "debounce" timer arrangement mentioned by sparkie in Post #13 might be more beneficial as long as your system can tolerate any "signal delays" that might result ...

here is another idea/approach that MIGHT help you move forward ...

the Point I/O hardware that you're using is obviously being set up as "Remote I/O" (specifically, not as "Local I/O") ...

take a look at the GREEN trace in Figure 22 at this link:

http://www.plctalk.net/qanda/showthr...0&postcount=16

that one looks a lot like the "stair step" appearance of your "problem" trace ...

now look at the MUCH SMOOTHER green trace shown in Figure 24 at this link:

http://www.plctalk.net/qanda/showthr...3&postcount=18

so ...

everything else being equal (not very likely) you MIGHT get some better results by tinkering with the RPI (Requested Packet Interval) and the RTS (Real Time Sampling) settings ...

I'm just GUESSING but maybe smoothing out the input signal MIGHT make your disturbance much quicker in duration and make any attempt to "filter" the input signal more effective ...

it hasn't been fully specified whether you're using CONTROL-Logix or COMPACT-Logix (in some cases it can make a difference) ...

I'm literally swamped with work right now so I won't be able to contribute anything further - but hopefully these ideas will be helpful (or at least mildly entertaining) ... good luck with your project ...
.
Attached Images
File Type: png spike%20filter.png (14.8 KB, 153 views)
__________________

2-B ?
Best regards, ----+----] [----+------------( )----
Ron | |
PLC Training Boot Camp | 2-B |
+----]/[----+

I once was lost, but now am found, was blind, but now I see.

  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
Micrologix 1400 analog input or 1762-IF4 eccan LIVE PLC Questions And Answers 2 July 26th, 2010 06:32 PM
Analog Input as Multiple Digital Input 69FIREBIRD LIVE PLC Questions And Answers 15 July 6th, 2010 04:28 PM
Analog Input Wiring Question 2 kbradray LIVE PLC Questions And Answers 1 January 25th, 2008 09:11 AM
Analog Input With Potentiometer HELP!! zmanvortex LIVE PLC Questions And Answers 26 May 11th, 2006 08:14 AM
Analog input issue! NoName LIVE PLC Questions And Answers 9 July 8th, 2004 04:10 AM


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


.