Calculating Flow per Second

Webhead

Member
Join Date
Jun 2005
Location
Central Florida
Posts
145
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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...
 
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.
 
jedft said:
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.
 
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
 
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
 
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
 
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.:confused:

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.
 
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.
 

Similar Topics

Hello. I'm about to start on a project about regulating a blower fan after a SetPoint where the customer enters a required Nm³/h, and the blower...
Replies
4
Views
3,033
This application has a motor with encoder feedback that drives a linear actuator that moves in/out, and is at roughly 45 degs from horiz. As the...
Replies
19
Views
1,296
I need to keep a running pass/fail yield of the previous 5,000 parts produced. I have used this formula before to calculate average: AvgValue =...
Replies
6
Views
2,113
Does anyone know how to calculate the savings from now needing to run an air compressor all day? Basically I have a design that replaced 6 * 1"...
Replies
26
Views
4,747
I would like to refer to this document of which I used some data ...
Replies
1
Views
1,450
Back
Top Bottom