Hi,
A simple way of intergrating an analog input is to Set up a timed instruction to add the input value every few seconds to a variable. e.g. if you have a flowmeter FT-XXX range 0-100 L/m and supposing the flow is at 45 L/m and your instruction executes every 6 seconds.
Divide FT-XXX by 10 (60/6=10 times per minute) and your instruction adds 4.5 to the variable every 6 seconds (4.5 x 10 = 45)
Of course you don't have to use 6 seconds you would get the same results by 45 / 20 every 3 seconds.
It's also easy to change your units for example Liters to M3 FT-XXX/10,000 every 6 seconds would give you 0.045
The main thing is to make sure your timer is accurate, use the real-time clock with a "GetSeconds" instruction rather than just a timer or wait instruction
It can be a little tricky but its easy to test by using a dummy variable in place of the flowmeter.
If your flow is very eratic, you may need to include a filter to smooth it out.
Hope this helps
Roy
I make a flow chart with an up timer with 1 second. The totalizer is accurate in short time, just few minutes.
But the error will be bigger in long time. I found that:
There is a small time delay since the controller knows the up-timer is expired to the time it starts the up-timer again.==> the actual total time for totalizing is = up-timer value + small time delay.==> it causes the error.and the problem is we can not count this small time delay. It varies, from 3 to 5ms. if it is constant, we would compensate for error.==> do you know how to fix this small time delay?In other words, do you have any other technique for totalizing a float value (not only analog input)? It must be accurate technique.