Accumulate flow value from a flow meter

noledge

Member
Join Date
Aug 2009
Location
Brisbane
Posts
11
I have got a flow meter that outputs 4-20mA signal input my 1762-IF4 input card.
I have done the calibration on the program so it's reading x litre/second now.

I need to write a program so the flow volume accumulates as the water passing through. I am think about using a combination of timer and counter to do this, but I just can't make it work. (No pulse output)

note. I am programming on a Micrologix 1400 Controller.
 
Create a moving average.

Using a timer, sample the 4-20ma every x msecs (x depends on the stability of your flow and the accuracy required).

Fill up a table of say 100 values with these samples, add them, divide by 100. As each new sample comes in, shift the table, dropping off the oldest value. When the flow meter is not running (IE pump off), force zeros into the table for each sample.
 
Noledge:

Are you looking for average flow as per Robertmee's example? Or are you looking for total flow over the course of a run? The latter is the meaning I took from your post.
Assuming I am correct, run a self resetting timer that every second adds the current flow to the total flow, and put the result in the total flow. Add some logic to reset the total between runs, and you should be ready to go. This is not as accurate as using a pulse output from the flow meter, as variations in the flow, or flow stoppage, will affect the total.

Stu.....
 
Noledge:

Are you looking for average flow as per Robertmee's example? Or are you looking for total flow over the course of a run? The latter is the meaning I took from your post.
Assuming I am correct, run a self resetting timer that every second adds the current flow to the total flow, and put the result in the total flow. Add some logic to reset the total between runs, and you should be ready to go. This is not as accurate as using a pulse output from the flow meter, as variations in the flow, or flow stoppage, will affect the total.

Stu.....

Yes, you've got me, I am looking for totalized flow through that particular flow meter.

Is there an instruction which samples my flow value every x amount of time? Or I am thinking to use 2 timers to make it on every 0.5second, and keep adding that value to a float value as the flow passing through.
 
Noledge:

In your post you said you had already scaled the input to Litres/Second. So, it you want the total Litres, you can use that value, or do some more math on it and convert it to what you want the Totalizer to read. You should only need one timer, and you could use 0.5 Seconds, or any time you want. There is no point getting to carried away though, so that you are updating faster than the Flow Meter Update Rate, or the Analog In Card Update Rate, and the Program Scan time must be considered as well.
At each time cycle use an XIC Done Bit to add the Current Flow to the Total Flow, and put the result in the Total Flow. Use an XIO Done Bit in the Timer rung to reset it.
I haven't used the 1400, and that Analog In Card, but unless it gives you data in Real (Floating Point), I don't see a big advantage in storing the data in a Float.
Hope that helps.

Stu.....
 
Noledge:
I haven't used the 1400, and that Analog In Card, but unless it gives you data in Real (Floating Point), I don't see a big advantage in storing the data in a Float.

If you have the capability (even if the analog is an integer) and don't do the math in Floating Point or don't store the result in Floating Point, you risk losing/gaining the amount rounded up or down every calculation/sampling. This will end up in a significant error over a short time. And since doing this calculation has its own built in inaccuracies, this just compounds it.
 
Last edited:
I have got a flow meter that outputs 4-20mA signal input my 1762-IF4 input card.
I have done the calibration on the program so it's reading x litre/second now.

I need to write a program so the flow volume accumulates as the water passing through. I am think about using a combination of timer and counter to do this, but I just can't make it work. (No pulse output)

note. I am programming on a Micrologix 1400 Controller.

Couple thoughts
1. What is more important a flow reading
OR total volume per unit time
2. What accuracy do you want with either value?
What accuracy do you need?
What accuracy can you afford?
3. What is the time value of the volume value - minutes or hours etc?
4. What are you going to do with the volume value when you get it?

Dan Bentler
 
Couple thoughts
1. What is more important a flow reading
OR total volume per unit time
2. What accuracy do you want with either value?
What accuracy do you need?
What accuracy can you afford?
3. What is the time value of the volume value - minutes or hours etc?
4. What are you going to do with the volume value when you get it?

Dan Bentler


1. What is more important a flow reading OR total volume per unit time
Both important
2. What accuracy do you want with either value?
flow reading = L/S, Total Volume in m^3
What accuracy do you need?
Flow reading= 2 digit with 2 decimal places,
Volume = 5 digits with 2 decimal places.

What accuracy can you afford?
As accurate as possible
3. What is the time value of the volume value - minutes or hours etc?
This volume will keep increasing as the flow passing through the meter.
eg. A constant 6L/S flow going through the meter for 1 hr will gives 36m^3 total flow volume.

4. What are you going to do with the volume value when you get it?
Display on the Panel View Plus, this part is not a problem for me.
 
To put it simply if your time units is seconds all you have to do is add the current flow rate to your accumulator once every second.
Total = Total + Current Flow Rate
Since you want the accumulator in m3 divide it by 1,000 first.
Total = Total + (Curent Flow Rate / 1000)
If your flow rate was in liters per minute, you wouldn't wait a minute between updates but would do something like -
Every 6 seconds
Total = Total + (Current flow rate / 10,000)
(divide 10 for 6 times per minute, divide by 1000 for m3)
 
Last edited:

Similar Topics

Hi guys, After been in the game such a very short while, my laptop bag no longer fits all my cables. I'm sure some of you have cables dating...
Replies
10
Views
4,286
Hi All I'm using RSView32 7.2 RSView32 trendx 3.42(CPR 7) doesn't accumulate data. in addition,when i use placeholders as pens it seems that...
Replies
3
Views
6,007
Hi, The hardware is: Click Plc model # CO-O1DD1-O HMI model # S3ML-R magnetic-inductive flow meter model # FMM100-1001. I will set the flow meter...
Replies
4
Views
211
Dear All, I need a sample PLC program to count the output pulse of a mass flow meter so that a specific amount of mass (for example 100gm)can be...
Replies
2
Views
179
Has anyone installed Hp laserjet pro 4203 to OMNI 3000 or 6000 via ethernet..Is there a specific Config? I have a problem..Please advise
Replies
0
Views
72
Back
Top Bottom