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 July 7th, 2011, 12:31 AM   #1
frt
Member
United States

frt is offline
 
Join Date: Jul 2011
Location: nh
Posts: 2
Data manipulation- moving average

Hi all,
I am pretty new to the PLCs and I had a question about data handling.
I get readings from a pressure sensor and display it to the screen (I use EZSeries) the thing is, the pressure sensor readings fluctuate so much and I need to stabilize it somehow. I want to apply a moving average on the data and then display it to the screen. Is such thing possible ?

Thank you
  Reply With Quote
Old July 7th, 2011, 12:35 AM   #2
KalleOlsen
Member
Norway

KalleOlsen is offline
 
Join Date: Oct 2008
Location: Middle of Norway
Posts: 1,529
Quote:
Originally Posted by frt View Post
Hi all,
I am pretty new to the PLCs and I had a question about data handling.
I get readings from a pressure sensor and display it to the screen (I use EZSeries) the thing is, the pressure sensor readings fluctuate so much and I need to stabilize it somehow. I want to apply a moving average on the data and then display it to the screen. Is such thing possible ?

Thank you
You want to put moving average routine in the PLC? Yes, it is possible.
PLC make/type?

Kalle
  Reply With Quote
Old July 7th, 2011, 12:44 AM   #3
bmacattack33
Lifetime Supporting Member + Moderator
United States

bmacattack33 is offline
 
bmacattack33's Avatar
 
Join Date: Jun 2011
Location: Bentonville, AR
Posts: 585
Hi Frt,

Yes, that is certainly possible. Two questions: How often do you need to take readings, and how often do you want the average updated?
  Reply With Quote
Old July 7th, 2011, 07:07 AM   #4
danw
Member
United States

danw is offline
 
danw's Avatar
 
Join Date: Oct 2004
Location: midwest, USA
Posts: 2,003
Not to sidetrack a PLC solution but some pressure transmitters have a setup parameter typically called damping that smooths the output of the pressure transmitter.
  Reply With Quote
Old July 7th, 2011, 07:56 AM   #5
Mickey
Lifetime Supporting Member
United States

Mickey is offline
 
Mickey's Avatar
 
Join Date: May 2003
Location: Palmdale,Ca
Posts: 8,423
Quote:
the pressure sensor readings fluctuate
First why does it fluctuate so much?

If your EZseries supports math instructions then a simple filter might work for you.

Quote:
FV=FV+C(NV-FV)
Where:
FV= Filtered value
C= constant (range 0-1) The smaller the number the more dampening.
NV= New Value
__________________
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 July 7th, 2011, 10:43 AM   #6
bmacattack33
Lifetime Supporting Member + Moderator
United States

bmacattack33 is offline
 
bmacattack33's Avatar
 
Join Date: Jun 2011
Location: Bentonville, AR
Posts: 585
I'm not familiar with EZ series, but here is a way to do it on an SLC processor that is fairly simple.
Attached Files
File Type: zip PRESSURE SENSOR MOVING AVERAGE.zip (17.1 KB, 111 views)
  Reply With Quote
Old July 9th, 2011, 04:23 AM   #7
shooter
Member
Netherlands

shooter is offline
 
shooter's Avatar
 
Join Date: Sep 2002
Location: duketown
Posts: 1,665
mickey easy and simple that is what i like.
good
__________________
shooter@home.nl
skype paul.deelen
Computer Shooter
Paul Deelen
J. Wassenaerstraat 29
NL 5224 GG 's-Hertogenbosch
+31653300739
  Reply With Quote
Old July 14th, 2011, 12:44 PM   #8
frt
Member
United States

frt is offline
 
Join Date: Jul 2011
Location: nh
Posts: 2
Mickey thank you very much. The fluctuations decreased significantly. never thought that it would be this simple.

Also thank you all for your ideas and suggestions

Frt
  Reply With Quote
Old July 14th, 2011, 01:05 PM   #9
Mickey
Lifetime Supporting Member
United States

Mickey is offline
 
Mickey's Avatar
 
Join Date: May 2003
Location: Palmdale,Ca
Posts: 8,423
Quote:
Originally Posted by frt View Post
Mickey thank you very much. The fluctuations decreased significantly. never thought that it would be this simple.

Also thank you all for your ideas and suggestions

Frt
Your Welcome.
__________________
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 July 15th, 2011, 10:58 AM   #10
Lancie1
Lifetime Supporting Member + Moderator
United States

Lancie1 is offline
 
Lancie1's Avatar
 
Join Date: Jul 2003
Location: Alabama
Posts: 9,213
Quote:
The fluctuations decreased significantly. never thought that it would be this simple.
NO! The pressure fluctuations ARE STILL EXACTLY the same as they were. The only thing that decreased significantly is the fluctuations in YOUR DISPLAY OF THE PRESSURE.

This is something to keep in the back of your head. Most likely, for all normal every-day uses, your new average pressure will be what you want to use. At the same time you need to be aware of what the REAL pressure is doing - jumping around all over the place. At some time for some other use, this could be important.

For example, for controlling the draft pressure in certain gas and wood-fired boilers, it is important to keep the pressure from ever going positive. Positive pressure in the burn chamber can result in dangerous gases being expelled into an occupied area.

You can average this pressure over some time period to get a nice display number that is easy to read and follow, but at the same time, for the draft pressure controller, you must not use too long of an averaging time period to control the draft, otherwise it will go positive too often.

Last edited by Lancie1; July 15th, 2011 at 11:05 AM.
  Reply With Quote
Old July 15th, 2011, 11:17 AM   #11
FrancisL
Member
United Kingdom

FrancisL is offline
 
Join Date: Aug 2004
Location: Portsmouth UK
Posts: 160
I dont know about EZSeries PLC's, but many provide a first or second order filtering as standard, my control theory memory suggests this would be better than a moving average .
Or as DANV said the transmitter itself may provide filtering (damping)
__________________
Keeping it Simple takes thinking time.
  Reply With Quote
Old October 7th, 2011, 02:11 AM   #12
Luked
Member
Australia

Luked is offline
 
Join Date: May 2011
Location: Adelaide
Posts: 2
BMACATTACK - What you have programmed is useful, however it isn't strictly a moving average, it is a 10 second average with 10 samples, updated every 10 seconds. A moving averge continuously updates every sample, by deleting the last sample, summing the values and dividing the sum by the number of samples. The major difference is that moving average updates every sample.
  Reply With Quote
Old October 7th, 2011, 07:00 AM   #13
Clay B.
Lifetime Supporting Member
United States

Clay B. is offline
 
Clay B.'s Avatar
 
Join Date: Jun 2005
Location: Concord,NC
Posts: 1,304
Quote:
FV=FV+C(NV-FV)
Where:
FV= Filtered value
C= constant (range 0-1) The smaller the number the more dampening.
NV= New Value
Mickey,

I am so glad you posted this formula again. I was looking for this for a job I am working on right now and going thru all of your posts would have been a difficult task.


Thanks,
Clay
  Reply With Quote
Old October 7th, 2011, 11:05 PM   #14
Luked
Member
Australia

Luked is offline
 
Join Date: May 2011
Location: Adelaide
Posts: 2
I thought this might be useful for everyone who programs with RSLogix500, the attached document explains code for a MOVING AVERAGE otherwise known as a 'running average'. It uses the FIFO instruction as a clever way to control words. SLC_running_average.pdf
  Reply With Quote
Old October 7th, 2011, 11:11 PM   #15
Mickey
Lifetime Supporting Member
United States

Mickey is offline
 
Mickey's Avatar
 
Join Date: May 2003
Location: Palmdale,Ca
Posts: 8,423
Quote:
Originally Posted by Clay B. View Post
Mickey,

I am so glad you posted this formula again. I was looking for this for a job I am working on right now and going thru all of your posts would have been a difficult task.


Thanks,
Clay

Your welcome.
__________________
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
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
Moving a data problem fpaezp LIVE PLC Questions And Answers 6 June 15th, 2011 04:28 PM
For fun and learning. SMOKE LIVE PLC Questions And Answers 42 April 14th, 2010 10:53 AM
Saving data in PLC - possible? flyers LIVE PLC Questions And Answers 24 October 29th, 2006 09:45 PM
Moving data into a bit shift josepa LIVE PLC Questions And Answers 2 October 17th, 2006 08:37 AM
Hourly PLC Data Average for Each Scan mfeby LIVE PLC Questions And Answers 8 June 14th, 2006 09:52 PM


All times are GMT -5. The time now is 08:47 PM.


.