PLC as flow totalizer


Thread Starter


I have to set the total flow value, and system has to close the valve after total flow sensed by magnetic flow meter.

Do I need a flow totalizer in addition to flow meter, and can a PLC handle the batch function as mentioned above? (to get the flow rate from flow meter, totalize and compare it with preset value and send out command to valve).
Hello arfp1343;

It all depends on how precise you have to be in your calculations.

Total flow is (Sum of [flow/time *time]); So it is not too complicated to take a reading every 10 seconds, calculate the flow (for the past ten seconds), sum 6 of these readings and multiply by 60 to get total flow for 1 minute, and increment a register every minute with the latest flow value.
The problem is in a PLC the time readings tend to drift (which means your 10 second interval cannot be guarantied). So readings will be slightly off, and over time the actual value of total flow will not match your information.

To minimize the error, you could use a scheduled task for example, if available in your PLC.

If you can get a reading of total flow on your flowmeter (even if you don't have a transmitted value) you could have the operator read the actual total flow and "correct" your totalizer regularly to make it match with the flowmeter calculations.

Some PLCs offer alternatives: Rockwell's Controllogix has a hardware module that is dedicated to totalizing applications (1756sc-CTR8
8-Channel Counter/Flowmeter Module; Siemens offers a downloadable totalizer application program for their S7-300/400 PLCs that can be implemented in a scheduled task (OB35) to ensure stability of the calculations.

Hope this helps.
Daniel Chartier

Bob Peterson

most plcs these days have some means by which a very precise timebase is available. Integrating off that time base is quite accurate as long as you are careful about rounding errors.
If available, connect a pulse output from you flowmeter to a PLC input/counter. The only error involved is precision of your flow meter itself. Be sure to configure the pulse rate for the On and Off period at max flow rate to be longer then the PLC Input specs and scan time.
Sorry to deviate slightly, but can you advise on where I can find the downloadable Siemens totaliser software? I may have an application for it in the very near future.

Hello Shaun;

You will find the file Totalizer.exe on this Siemens support webpage:

Look at all the other applications available on the same webpage, at the top. If you have a few minutes, open the Applications and Tools menu at the page header; there you can access many functions developped by Siemens IT group (for PLC, HMI, communications, drives, etc); some are free downloads, some require that you pay a minimum fee (around 25-50 euros per download) through a Simatic payment card. But these applications are tested and supported; and they can save you a lot of development time.

Hope this helps,
Daniel Chartier
You will need to sample your flow rate at an accurate, constant rate (dT). Depending on the accuracy required, you should also consider using something like trapezoidal rule numerical integration to get more accurate results:
Total(n) = Total(n-1) + (Flow(n) + Flow(n-1))/(2*dT)

Finally, you need to consider round-off errors as your total value becomes large in relation to the small increment in flow you add every calculation period. Using double-precision floating point for the total calculation can help.

Rockwell Automation's ControlLogix and CompactLogix controllers have a built-in Totalizer instruction made to handle this exact application and which uses the above techniques to improve accuracy.
You know, there's a relatively easy way to do this. If what you are trying to do is to totalize flow, many flowmeters have a scaled pulse output (one count equals n volume units). A simple low speed counter then works as a totalizer.

If you also need to display flow rate, you may have to also pull a 4-20 mA pair. At that point you need to decide what the aggregate work burden is, and decide accordingly.

Walt Boyes
Editor in Chief
Control and
Mailto:[email protected]
Read my blog SoundOFF!! At
All these fancy timing methods are OK, but don't forget the accuracy of your flowmeter is probably +/- 0.5% at best. So what's the point in using super accurate timers?

Before real time clocks we used timers & counters with a few seconds correction at midnight with quite accurate results.

Is flow totalizing from pulse output is more accurate or from 4-20mA from flow transmitter out put on plc?

Flow totalization from the pulse output of the flow meter is significantly more accurate than from the 4-20 loop. Simply increment a register one time per "n" pulses. You may need a high speed input card because some flow meters have high frequency pulse outputs.

Walt Boyes

Sent from my iPad