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

Get the book!

If you're really looking to learn about PLCs, you NEED our book...

"Your Personal PLC Tutor - A Guide to Understanding PLCs"

Easy to read and uses 'plain' language!
Get $$FREE$$ priority mail shipping too!!!
You WILL be glad you did!!

Click Here now to order

Reply
 
Thread Tools Display Modes
Old January 31st, 2007, 01:14 PM   #1
Webhead
Member
United States

Webhead is offline
 
Webhead's Avatar
 
Join Date: Jun 2005
Location: Central Florida
Posts: 85
Calculating Flow per Second

I am currently looking at a program done by a colleague from another company and I am trying to figure out why he used a specific math function for flow and why. He was trying to calculate Flow per Second of a given flow meter. The thing I don’t really get is he used the scan time of the PLC to get the flow per second calculation. Has anyone ever done this before and if so can you explain why the scan time was used. Below is a copy of the math.



Flo/Sc,0 = GPM,0 / 60 * ScanTm / 100



GPM,0 is the flow of the meter

ScanTm is the Scan Time of the PLC in milliseconds



I’m sure there is a reason for it but I’ve never used the Scan Time in a PLC other than to check for system faults etc.



Thank in advance.
__________________

There are 10 kinds of people in this world. Those that understand binary and those that don't.

  Reply With Quote
Old January 31st, 2007, 01:55 PM   #2
doug2
Member
United States

doug2 is offline
 
Join Date: Dec 2006
Location: california
Posts: 169
wow thats interesting. depending on what he is doing with the number after the calculation he may be getting better resolution. Actually looks like a pretty cool idea. instead of sampling ever second he is doing it every scan.


I think its supposed to be /1000 though.

Or a little easier:

gpm /60,000 * scan time.
  Reply With Quote
Old January 31st, 2007, 02:52 PM   #3
jedft
Member
United States

jedft is offline
 
Join Date: Jul 2004
Posts: 118
Yep, that's how I do a flow totalizer. It may be a little anal but I average the flow value (GPM) for the last 2 scans and multiply that by the last scan time (coverted to minutes)to get the average gallons during the last scan. Then add that to the previous total and set the current value to last scan value.
  Reply With Quote
Old January 31st, 2007, 03:21 PM   #4
Alaric
Member
United States

Alaric is offline
 
Alaric's Avatar
 
Join Date: Apr 2005
Posts: 3,979
Keep in mind that analog inputs generally are an much slower than the PLC scan time. The PLC may complete twenty or more scans while the A/D does a single conversion.
  Reply With Quote
Old January 31st, 2007, 03:31 PM   #5
jedft
Member
United States

jedft is offline
 
Join Date: Jul 2004
Posts: 118
Yeah, but the analog update time is not a system word in the PLC as is the last scan time. Like I said it's a little anal because flow doesn't measurably change that fast anyway, but it's going to be as accurate as you can get.
  Reply With Quote
Old January 31st, 2007, 03:34 PM   #6
doug2
Member
United States

doug2 is offline
 
Join Date: Dec 2006
Location: california
Posts: 169
yeah I usually totalize 1 time per second when it is just for a visual. when we want to get better acuracy we use a pulse input to a hispeed counter card. But I still like your style on that 1.
  Reply With Quote
Old January 31st, 2007, 03:37 PM   #7
Webhead
Member
United States

Webhead is offline
 
Webhead's Avatar
 
Join Date: Jun 2005
Location: Central Florida
Posts: 85
I'm still a little confused. Can someone break it down a little better. I almost understand but it's not crystal clear yet.
__________________

There are 10 kinds of people in this world. Those that understand binary and those that don't.

  Reply With Quote
Old January 31st, 2007, 03:49 PM   #8
doug2
Member
United States

doug2 is offline
 
Join Date: Dec 2006
Location: california
Posts: 169
analog input / 60 (gives gallons per second) * scan time (sample interval) / 1000 (because the sample was in mils)

you were probably expecting

a 1 second pulse generator initiating a:

analog input / 60

That would probably be very very close but your solution takes more samples so should see the change in gpm faster.

Hope that didnt confuse you more...
  Reply With Quote
Old January 31st, 2007, 03:53 PM   #9
jedft
Member
United States

jedft is offline
 
Join Date: Jul 2004
Posts: 118
Hmm, now that I really think about your program there... I'm not sure why he's using the scan time either.

GPM/60 = GPS

That should be the end of it.

The only reason to bring scan time into it is to find actual volume, not rate.
  Reply With Quote
Old January 31st, 2007, 05:07 PM   #10
Tom Jenkins
Member
United States

Tom Jenkins is offline
 
Tom Jenkins's Avatar
 
Join Date: Apr 2002
Location: Milwaukee, WI
Posts: 4,349
Quote:
Originally Posted by jedft
Hmm, now that I really think about your program there... I'm not sure why he's using the scan time either.

GPM/60 = GPS

That should be the end of it.

The only reason to bring scan time into it is to find actual volume, not rate.
I agree. Rate = Volume / Time

Therefore, Rate x Time = Volume

This is apparently a totalizer of some kind, but totalizing over such a short interval is unlikely to provide good results.
  Reply With Quote
Old January 31st, 2007, 06:22 PM   #11
bradal
Member
Canada

bradal is offline
 
Join Date: May 2006
Location: edmonton
Posts: 126
Wink

In my experience trying to totalize from the analog on a flow meter does not work. You may get it very close to the reading on the 4 to 20 mA, but there are other issues. In a typical set-up we will use an endress and hauser flow meter, sending a pulse every 0.1 cubic meter, in addition to the analog. This allows the local flow meter totalizer to remain in sync with the value displayed at the screen. I would be very impressed if you could get a flow total to match on a flow meter and the SCADA system after 5 years. And if they didn't match, we would get a call, or the computer goes down and they have to take readings locally. If the local readings are off from previous day then there dosages would be off for chemical.

Using an analog you have error on the output of the flow meter, noise on the signal line, error on the input card, and of course some degree of error on your calculation.

My 2 cents
  Reply With Quote
Old January 31st, 2007, 06:46 PM   #12
Norml
Member
United States

Norml is offline
 
Join Date: Nov 2006
Location: Maine
Posts: 201
For the past couple of projects, I used a .5 sec timer to totalize flow after having seen it in somebody else's application (ahem). The station flow rate (in GPM) shown at the flowmeter and on the HMI were close enough. It's also a good idea to zero out the flow when it gets below a minimal value
  Reply With Quote
Old January 31st, 2007, 10:11 PM   #13
Black Jack
Member
United States

Black Jack is offline
 
Join Date: Dec 2006
Location: Northwest
Posts: 30
I've found that integrating an analog signal is easier using a timed interrupt. Calculate the flow for the interrupt time and add it to the running total.

100mS interrupt would just add flow rate * .00167 every execution.

I have tried just using a standard timer and you would be suprised how inaccurate they are. A 100 mS timer would typically be off by the program scan every time it elapses and runs into a huge error over time.

Just my $.02
  Reply With Quote
Old February 1st, 2007, 08:02 AM   #14
Webhead
Member
United States

Webhead is offline
 
Webhead's Avatar
 
Join Date: Jun 2005
Location: Central Florida
Posts: 85
Exclamation

Yes the GPS is used in a totalizer to calculate the Total Gallons per Day. What I'm not getting is the whole scan time part of the calculation how is it adjusting the sample rate? Maybe I don't understand PLC Scans that well and I have been doing this kind of work now for 15 years.

The problem is theses flow accumulations that this part of the program is used for have been getting increasingly higher. They are used on the Influent and Effluent flows of a waste water plant and for some reason they are losing about 800K gallons on site somewhere. It's a waste water plant what goes in has to come out somewhere.

I'm leaning towards the flowmeters themselves, I'm going to have them checked out with a drawdown or something to see how accurate they are.
__________________

There are 10 kinds of people in this world. Those that understand binary and those that don't.

  Reply With Quote
Old February 1st, 2007, 08:30 AM   #15
jedft
Member
United States

jedft is offline
 
Join Date: Jul 2004
Posts: 118
OK, see your original question made it sound like you were only displaying gallons per second.

The reason to use scan time, or any time is because you are taking a rate (GPS) and need to turn it into a volume (Gallons) By definition GPS is a volume divided by time. V/T=Rate as Tom stated before. So to extract volume out of that equation you have to multiply it by time.

Let me see if I can walk through this:

You are getting a value of 100 GPM from the flow meter.

100GPM/60 = 1.666667 GPS - This is still a rate of flow.

1.66667GPS * ScanTime(In seconds) = Gallons Flowed in ScanTime

Lets say the scan time was 6mS. You have to divide that by 1000 to convert it from milliseconds to seconds.

So now we have 1.66667GPS * .006 seconds = 0.0100002 gallons that flowed during the last scan.

So we take that 0.0100002 and add it to the previous total.

Now the REASON to use scan time is that if you use a timer in the program you are going to introduce an error due to the scan time (it is not always the same every scan). Scan time is typically tracked by most PLCs and available as a system word, so it is a convienient way to get a reliable time to use in the equation. However, as others have pointed out here, it is a VERY small number and may have its own problems due to that.
  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
Engineering Units for Flow Greg Dake LIVE PLC Questions And Answers 11 December 29th, 2006 02:43 PM
Controlling flow using PID or other method? flyers LIVE PLC Questions And Answers 16 November 28th, 2006 02:54 AM
Сoriolis flow meters question girevik LIVE PLC Questions And Answers 12 June 28th, 2006 01:53 PM
Boiler Fuel Feed Simulation for Bunker C sjknight LIVE PLC Questions And Answers 1 November 20th, 2005 04:42 PM
Flow Ladder Logic slenkovj LIVE PLC Questions And Answers 10 June 17th, 2003 08:20 AM


All times are GMT -5. The time now is 12:01 AM.


.