*A storage tank modeling tool.*

Copyright © 2019, Paul Lutus — Message Page

TankFlow is released under the GPL.

Visit the TankFlow Home Page for more information and to be sure you have the latest version.

*For formatting reasons, users may want to temporarily make the TankFlow program frame larger to properly read these instructions.*

*Users may prefer to search this document using the search feature at the bottom of this display.*

How TankFlow Works | Recording Data | Importing Data into TankFlow

Processing TankFlow Data | Additional Features | Conclusion

How TankFlow Works

TankFlow is a tool for profiling storage tanks. There are several methods to create a tank profile. One is geometric modeling with a program like my TankCalc. The geometric modeling approach requires that the tank's shape be known with good accuracy.

For tanks with irregular shapes, or whose shape is unknown, another method is possible — a controlled fill, with a recording made of time, flow rate and sensor height as the fill proceeds. This is what TankFlow is designed to do — it accepts plain-text data entries consisting of individual lines (records), each consisting of time, flow rate and sensor height. If reasonable care is taken, this method can produce an accurate tank profile, even if the tank's shape is unknown.

Here are the details:

- During a controlled tank fill from empty to full, one records the time, flow rate and sensor height at periodic intervals — more data, better accuracy.
- A fill measurement has this format:

- 12:34:22 (time as hours, minutes and seconds, recorded to the second if possible)
- 18.45 (flow rate, any convenient units)
- 1000.56 (sensor height, any convenient units)
- Individual measurement records look like this, separated by commas or tabs, possibly in a spreadsheet or text file:

- 12:34:22, 18.45, 1000.56
- 12:45:11, 20.32, 1100.33
- (and so forth ...)
- TankFlow reads data records like the above and converts them into a profile of tank partial volume that is correlated with sensor readings. In this example, for the two records above, TankFlow determines that 10 minutes and 49 seconds passed between the first measurement and the second (12:45:11 - 12:34:22 = 00:10:49). Because the flow rate changed between the first and second data recording, TankFlow calculates the average flow rate as 19.385 volume units ( (18.45+20.32)/2 = 19.385), and it doesn't matter which volume units are used.
- Now TankFlow computes a new partial tank volume, which is equal to the average flow rate times the elapsed time — in this case, the tank's volume increased by 19.385 units per minute, times 10:49 = 209.68 units. For each new measurement TankFlow adds a partial volume to a running total of tank volume, and over time it builds a table of partial volumes correlated with sensor heights.
- At the end of the process, TankFlow has a table of tank partial volumes and sensor heights, one item per measurement.
- Next, TankFlow turns these data into a continuous function, so any sensor height can be converted into a volume. To do this, TankFlow creates a mathematical function that produces a volume for any sensor height, or the reverse (sensor height for volume).
- To convert the set of data points into a continuous function, TankFlow uses a method called Polynomial Regression, a reliable and fast mathematical method.
- Having created a function that represents the measured tank's profile, TankFlow creates a visual graph of the relationship between the raw data and the function, as an accuracy check. TankFlow also generates a table with user-defined parameters, arranged either as volume to sensor height or the reverse.
- All the above results can be created without knowing anything about the tank being measured, which is perfect for tanks that are buried or otherwise inaccessible, but whose properties must be known.
Figure 1: Example polynomial regression chart

Figure 1 shows a typical polynomial regression result, in which the red data points (representing field measurements) are matched with a mathematical function (represented by the blue line) created by the method used in TankFlow.

Recording Data

The first and most difficult part of the TankFlow task is a controlled tank fill with detailed record-keeping. Here are some preliminaries:

- Acquire a good source of accurate time, with an easily readable hour/minute/second display. Remember that the difference between times is important, not the absolute time.
- Use the best content height sensor available.
- Choose a flow-meter that is accurate, consistent and whose display is easy to read.
- If possible, the source tank should be larger than the measured tank. This is so the flow rate won't change dramatically during the fill, an effect that would degrade measurement accuracy.
- Record plenty of data. If a tank fills in two hours, take readings every two minutes or more often. Set a goal of 100 or more data points if possible.
- Record hours, minutes and seconds if possible. TankFlow will accept records containing hour/minute time fields (example 09:54), but this degrade accuracy.
- Record times using a 24-hour clock if possible, i.e. 09:00, 12:00, 14:00 etc. Don't include AM/PM entries as part of your data. A 12-hour clock can be used, but it's easier to interpret 24-hour clock times.
- If the time rolls over from one day to another (or from AM to PM on a 12-hour clock) during the fill, just record the time as shown on the clock — TankFlow knows how to deal with clock rollovers.
- Again, include seconds in your time data if at all possible, this greatly improves accuracy.
- Remember to
excludeAM/PM notation in your times, so a time of 1:23:45 PM would be entered as 1:23:45.At the end of the process, you should have a plain-text file or a spreadsheet containing records that look like this (but many more):

From left to right, the fields are:00:35:00,200.00,356.60 00:40:00,210.00,390.59 00:45:00,190.00,423.36 00:50:00,205.00,455.08 00:55:00,200.00,485.92

- Time, hour:minute:second if possible, hour:minute otherwise.
- Pump flow rate, any convenient units. The resulting volume profile will have the same units.
- Sensor height, any units.
The commas between the fields are optional, you may use tabs or spaces instead, but the individual fields should be separated in an unambiguous way.

Importing Data into TankFlow

For simplicity, all data transfers are by way of the system clipboard. If the source is a text file, copy the entire file to the clipboard:

- Move your mouse cursor into the file of interest, so the cursor has focus.
- Select the entire file content with Ctrl+A (PC) or Command+A (Macintosh).
- Copy the data by pressing Ctrl+C (PC) or Command+C (Macintosh).
- In TankFlow, select the "Flow Data" tab, then paste the data table using Ctrl+V (Paste).
The above steps should place the data table in the "Flow Data" tab's text window.

Processing TankFlow Data

- Once the data are pasted into the "Flow Data" window, select the "Sensor/Volume" tab and press the "Convert" button. This action converts individually recorded times and flow rates into a table of partial tank volumes correlated with sensor heights.
- To create a more useful result, one that is continuous, move to the "Regression" tab and press "Perform".
- To get a preliminary look at the regression result, move to the "Graphic" tab and compare the image with Figure 1 above. If the blue line crosses through the red dots, this indicates that the regression was successful. While visiting the graphic tab, notice that moving your mouse cursor across the image shows the coordinates of parts of the generated curve.
- Another indication of success are the "Correlation Coefficient" and "Standard Error" numerical results on the "Regression" tab. Ideally, the "Correlation Coefficient" value should be near 1.0 and the "Standard Error" value should be close to zero.
- If the blue line is not aligned with the red dots, increase the "Polynomial Degree" value and run the regression again (press "Perform"). The "Polynomial Degree" value can be as much as 1/3 to 1/2 the number of data points, but like most things, one can have too much of a good thing (too high a polynomial degree setting causes the generated function to misbehave).
- Once you have a satisfactory result, move to the "Table" tab, enter appropriate start, end and step values and create a table. This table is created using the mathematical function produced in the regression activity, and with practice, it should produce very accurate and reliable results, comparable to published tank profiles created using other methods.

Additional Features

TankFlow can create a mathematical function to provide a partial volume for any sensor height, but it also handles the reverse case — a sensor height for a volume. To get this alternate form, on the "Regression" tab select "Reverse x <-> Y Data" and press "Perform" again.

Once you have a useful mathematical result, TankFlow allows export of many kinds of computer code containing the created function. Just select the desired computer language using the "output format" selector on the "Regression" tab (top center), then copy the displayed code from the window below.

If you already have a data table of partial volumes and sensor heights, in other words if you don't need to convert from flow rates, simply select the "Sensor/Volume" tab and post your data there, then proceed with the regression analysis.

The most difficult and error-prone part of this procedure is the field measurements. TankFlow has a way to correct for systematic errors that may come up in the controlled tank fill, so the data agree with a known full tank volume and zero point. To use this feature, go to the "Regression" tab and make entries in the "Correction Low" and/or "Correction High" entry windows, and enable the desired values using the adjacent checkboxes. Then run the regression again. Generating a table and examining its values is one way to test the outcome of this adjustment procedure — the generated table should have the expected starting and ending points even if the field data are not perfect.

TankFlow remembers everything between uses. It saves its program settings and data in a user directory located on this machine at (user directory). This allows the user to quit the program and restart at a later time with all data preserved.

Conclusion

There is much more information about TankFlow and similar programs and methods at the TankFlow Home Page.

To report bugs or suggest improvements, visit the arachnoid.com Message Board.