![]() |
||
|
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc. |
||
| ||
New Here? Please read this important info!!!
|
|||||||
![]() |
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!
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Member
|
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. |
|
|
|
#2 |
|
Member
![]() 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. |
|
|
|
#3 |
|
Member
![]() 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.
|
|
|
|
#4 |
|
Member
|
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.
|
|
|
|
#5 |
|
Member
![]() 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.
|
|
|
|
#6 |
|
Member
![]() 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.
|
|
|
|
#7 |
|
Member
|
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. |
|
|
|
#8 |
|
Member
![]() 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... |
|
|
|
#9 |
|
Member
![]() 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. |
|
|
|
#10 | |
|
Member
|
Quote:
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. |
|
|
|
|
#11 |
|
Member
![]() Join Date: May 2006
Location: edmonton
Posts: 126
|
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 |
|
|
|
#12 |
|
Member
![]() 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
|
|
|
|
#13 |
|
Member
![]() 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 |
|
|
|
#14 |
|
Member
|
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. |
|
|
|
#15 |
|
Member
![]() 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. |
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
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 |