# Calculating rate from tank level change

Latest reply on Oct 22, 2018 by gorez69

Hi, I am relatively new to creating performance equations and have been struggling to find the best method.

I have a tank which the level is measured. liquid comes into the vessel and once at a specific height (although height can change) the liquid is discharged down to another specific level (gap level control). The rate of liquid in can vary and the rate of liquid out can also vary. This control creates a sawtooth trend as per below. My aim is to create a performance equation to estimate based on the level change the rate of liquid coming into the tank. I tried a method to use a IF statement with time as per below but get errors over the peak and gaps in data.

IF ('LEVEL'-TAGVAL('LEVEL,'*-5m')) > 0 THEN ('LEVEL-TAGVAL('LEVEL,'*-5m')) ELSE NoOutput()

A friend suggested I try the equation below but I also have not had great results.

IF 'LEVEL' < PrevVal('LEVEL', '*') THEN (tagMax('LEVEL', '*', '*-10m') - tagmin('LEVEL', '*-60m', PrevEvent('LEVEL', '*')))/(FindEq('LEVEL', '*', '*-10m',tagMax('LEVEL', '*', '*-10m')) - FindEq('LEVEL', PrevEvent('LEVEL', '*'), '*-60m', tagmin('LEVEL', '*-60m', PrevEvent('LEVEL', '*'))))*3600 ELSE NoOutput()

I am keen to use this as a learning opportunity so happy for any feedback. I had a search but couldn't find an example of what I am doing.

I am trying to complete the same activity (determine rate of liquid loss) for the loss of level from another tank. As per trend below. The data has some variability in it and hence I have errors determining rate when looking over the short time period. 