Hi guys. This is kind of an odd question for EE I know but I thought it was worth giving it a shot.

I'm making a project for my company where we use a PLC/HMI to get real-time data from several transmitters both digital and analog (pressure, on/off switches and level). The level is measured with a HART radar using a 4-20mA loop from Siemens in a tank.

What I need is to calculate the flow of the liquid going into the tank using only the level. If I were using a PC programming language like C++, Basic, Java or even PHP, it would be easy but since the calculation has to be done by the PLC which uses LADDER programming, I don't know what is the best way to calculate it.

The flow calculation doesn't even has to be in real-time. I mean, I can refresh it every 10 to 30 seconds.

We've tried using a BLINK for X seconds (tried 10 and 20 seconds) that grabs the level when the blink began and then the level when the blink ends but I don't like that. Is it possible to use a ramp calculation or something like that? What would be the best (with the less error) way?

Thanks in advance!

What kind of data do you get inside the PLC? Only level?

How do you get the data inside the PLC? In what format?

Each PLC has basic arithmetic functions, therefore some calculations can be implemented.

If you get only one parameter inside the PLC liquid level as analog value, then you can calculate only with that parameter and the time.

You measure as fast as possible and make the difference between 2 readings. The knowing the tank volume you know the flow.

The only way to have abetter precision in this case is more readings. There is no other control.

If you have also other info from tank, from other sensors, then the situation may improve.