Analog Flow to Pulse output

svarney

Member
Join Date
Feb 2012
Location
So. Wi
Posts
4
I am trying to figure out how to take a analog signal (flow) and generate a pulse very 1000 gallon for a flow totalizer on my panel. Using Logix5000.

I am stumped.
thanks scott
 
that really did help much. I don't have a pulse output on the DP cell to use. I guess I will have to look for other options. I was hoping there was a AIO block in the 5000 platform.
 
I think you could use a regular output, one pulse per 1000 gallons won't have a very high frequency I imagine?
 
You could create your own AOI to do this.

First you will need to create a flow totalizer in the logic so you know when 1000 gallons is coming up. There are lots of posts on the site that explain how to take an analog flow signal and create a totalizer out of that.

Then when the 1000 gallon mark is met you can turn on the output and keep it high for a certain amount of time then turn it off. Or you can create a 50/50 pulse and have it on for 500 gallons and off for 500 gallons. That is how most low resolution pulse are done in my industry.
 
If I understand the OP's question, he has an analog input to his PLC that represents flow. He wants to generate an output pulse at each 1000 gallons of flow.

Let's assume you have already scaled the 4 - 20 mA signal from the flow meter to engineering units like gallons per minute. Once per second capture the GPM value and divide it by 60 (because one second is 1/60th of a minute) and add the result to a running total. When the running total reaches 1000 generate your pulse output, subtract 1000 from the running total and wait for it to reach 1000 again.
If the flow varies a lot and you need more accuracy, instead of using the captured GPM value each second, take the average of the current sample and the value you captured one second ago.
 
You need something called integration, at constant and small period of time you add the measured flow to a total.

The time period must be precise and not smaller than the flow reading period, each period need a new flow reading, if the flow oscillates then you need shorter periods, a fast integration.

How to convert the total to gallons depends of flow scale and the period too, it will need some math calculation. When the total arrives to the equivalent to 1000 gallons then you subtract the equivalent to 1000 and generate a pulse.

The calculation should be evaluated to avoid overflow, for me the best is to use a 32bit integer for the total, not a floating point.
 
Last edited:
If I understand the OP's question, he has an analog input to his PLC that represents flow. He wants to generate an output pulse at each 1000 gallons of flow.

Let's assume you have already scaled the 4 - 20 mA signal from the flow meter to engineering units like gallons per minute. Once per second capture the GPM value and divide it by 60 (because one second is 1/60th of a minute) and add the result to a running total. When the running total reaches 1000 generate your pulse output, subtract 1000 from the running total and wait for it to reach 1000 again.
If the flow varies a lot and you need more accuracy, instead of using the captured GPM value each second, take the average of the current sample and the value you captured one second ago.

+1 : but I would make the "running total" a REAL, so you don't lose precision on the divide.
 
Using a REAL to totalize has a risk, try for example to add 20,000,000 and 1 with REALs, the result will be 20,000,000, the 1 will not be added.
For me better to use a big integer
 
Using a REAL to totalize has a risk, try for example to add 20,000,000 and 1 with REALs, the result will be 20,000,000, the 1 will not be added.
For me better to use a big integer

I'm aware of that risk, but as Steve suggested, GRT 1000.0, SUB 1000.0 works for me....
 
Obviously, we are all assuming the flow rate is fairly constant...
What makes you say that? When you sample the flow rate once per second and add that sample to the running total you are making accommodation for changes in the flow rate. You can sample more frequently than once per second if necessary, limited only by the PLC's scan time and the update rate of the analog input module's A/D conversion.
 
What makes you say that? When you sample the flow rate once per second and add that sample to the running total you are making accommodation for changes in the flow rate. You can sample more frequently than once per second if necessary, limited only by the PLC's scan time and the update rate of the analog input module's A/D conversion.

We know little of the specifics, and even less of the accuracy that is to be achieved so it doesn't hurt to keep in mind a possible source for error.
 

Similar Topics

Given the variety of opinions about the wisdom and feasability of totalizing an analog flow signal I ran a test by totalizing both the analog flow...
Replies
0
Views
3,390
Can someone tell me if this math function is correct to totalize analog flow in a 30 Milsec peridoc task...
Replies
3
Views
1,718
As my confidence grows with working with multiple control systems, I am starting to take more and more on, where before I would just pie it off...
Replies
4
Views
3,431
I have a Flow meter that returns a 4-20 signal and the problem I have is the pump is a diaphram pump so theres alot of pulsing causing my...
Replies
19
Views
7,990
I've never programmed analog control in ladder. Here is what I'm trying to do. Flow 1 Analog input 1 - (4-20ma)0-50 lbs sec, this input is...
Replies
0
Views
5,033
Back
Top Bottom