7 Replies Latest reply on Jan 4, 2019 7:44 AM by Olav

# Calculate total tank consumption for a period

Hi.

I have a case where I want to create a PI AF calculation that calculates the use of liquid from a tank during a certain period, example 3 months at a time. The tank is refilled at irregular intervals and drained periodically and in different amounts of volumes. Now, I need to know how much was drained/refilled during this time period. I need suggestions on how to do this most efficiently.

Appreciate any advice on the matter.

-Olav

• ###### Re: Calculate total tank consumption for a period

Hi Olav,

What information are you sensing / recording for this tank? If it is just the tank level, can it happen that liquid is taken from the tank while it is refilled? If so, I doubt you will be able to get the exact amounts from just the level information. Also, how does the liquid density change when the temperature is changing?

• ###### Re: Calculate total tank consumption for a period

Hi.

I only have the level sensor. It has already been calculated into liters by the control system, so I am getting the signal as liters. It is rarely refilled and drained at the same time. Both are manual operations. I don't need a 100% accurate calculation. This is on a sea vessel, so the signal also fluctuates. I've made a filter calc that flattens the signal a bit.

At the moment they are calculating the usage manually, that is, they look at the trend in processbook and calculate the difference whenever they see a drain or fillup. I was hoping to do this a little bit more automatic, since the manual calculation is pretty time consuming.

• ###### Re: Calculate total tank consumption for a period

Hi Olav

I would suggest you to use Event frames to capture the level before start trigger condition is met and calculate the difference between volumes at the end of trigger condition.

Similar example :Add Output Expressions to Event Frames

Thanks,

Lal

1 of 1 people found this helpful
• ###### Re: Calculate total tank consumption for a period

There are a few ways to do this.  You might want to see this similar thread: Total positive changes only

1 of 1 people found this helpful
• ###### Re: Calculate total tank consumption for a period

Back in the '90s, I was tasked with a similar situation. Mix tanks were filled with various ingredients, agitated, and then the mixture pumped off.

The system provided the amount of each ingredient added to the tank, and the amount pumped out.

To determine usage over time, the tank volume level was checked.

When the volume level increased, the preceding value was marked as the 'low' point; when the volume level decreased, the preceding value was marked as the 'high' point; the usage was the 'high' point value minus the 'low' point value.

The application did not run continuously, it was batched, so in a single run, there were potentially many usage values.

You should be able to devise a similar system in AF.

1 of 1 people found this helpful
• ###### Re: Calculate total tank consumption for a period

When I was a customer, I used ACE to perform this.  ACE had to be used even after Analytics because I needed precise control over the timestamp.  The logic employed was:

• There was a constant for noise filtering so that only a significant change up (Filling) or down (Draining) was captured.  Anything within the noise factor was considered Idle, or no change.
• I had a digital tag for tank status { Idle, Draining, Filling }.
• I had one ACE calc to determine the most recent tank status triggered by change in level.  This would take the current (triggered) level and compare it to the previous level, factoring out any noise.  It only updated the tag when the tank status truly changed.  Note this could be made in an Analysis instead of using ACE (see below).
• In another ACE calc that was triggered on tank status change, it then calculated the difference between now (the trigger time) and the last time the status had changed.  An Idle period would always be hard coded as 0 to filter out noise.  Draining is negative.  Filling is positive.  Unless your verbage is "Usage" then Draining is a positive usage, but that is semantics.
• My first inclination was to timestamp the amount changed at the trigger time, but this was at the end of the evaluation period.  I later revised my ACE calc to use the time stamp that began each respective Draining or Filling period.  Because of this precise timestamp requirement, ACE had to be used over Analytics.

What I then had at my disposal was a tank status { Idle, Draining, Filling } as well as a corresponding volume for that status.  For any given time range, I could detect and add up all Filling periods, or all Draining periods.

To use Analytics to calculate the new tank status, again triggered by a change in level, here is one attempt.  Note I am using Sinusoid for tank level.

1 of 1 people found this helpful
• ###### Re: Calculate total tank consumption for a period

This looks very promising. I think I will try this method. I will probably skip the draining state though, because it seems to be draining very slowly, so the window between noise factor and draining would be very small. And to know how much product they have used, I really only need to know how much the filled during a certain period.