Home | | Mathematics | | * Applied Mathematics | | * Storage Tank Modeling | | Share This Page |
A special-case analyzer for large storage tanks.
Copyright © 2009, Paul Lutus — Message Page
This page contains Java program code to analyze a tank type so specialized that I didn't want to try to integrate it into TankCalc. The program models what is normally a large, high-capacity tank that has different internal radii at different heights (with walls thicker at the bottom to bear higher pressures), optionally with an inverted cone at the bottom and/or a spherical segment at the top as shown in figure 1.
This Java program can analyze the described tank very accurately — as accurately as the measurements that are provided to it. The tank is assumed to be level or nearly so — for tanks in this class with stepped interiors, there is no reliable way to analyze such a tank if it is tilted to any substantial degree.
Like TankCalc, TankStepped produces a list of sensor heights and corresponding partial tank volumes, with a resolution specified by the user. Unlike TankCalc and because the modeled tank is assumed to be vertical, all the results are acquired using closed-form equations (listed below) for very high accuracy.
Update: Be sure to consider the new TankProfiler method for this tank type.
I have written this program in Java to minimize portability difficulties — it should run on virtually any platform presently in use. Here are the steps to get it running:
- Install a Java runtime engine, available for free at http://java.com. You may already have a suitable Java runtime, if so you can skip this step.
- Dowload the Java program file by clicking here. Save this file anywhere convenient.
- Open a command shell (Windows calls this a "Command Prompt", if you have never opened one before, it is located under "Start ... All Programs ... Accessories .. Command Prompt").
- Navigate to the location of the Java JAR file you just downloaded.
- Just to make sure things are set up properly and a suitable Java runtime engine is installed, type "java -jar TankStepped.jar -v" and see that the Java program responds with "TankStepped version (version number)".
- The version number should agree with the version that appears at the top of this page.
- To avoid quite so much typing while using TankStepped, download one of these shell scripts:
- Windows: download this shell script.
- Linux: download this shell script and give it executable permissions.
- Put the selected shell script in the same directory as TankStepped.jar.
Now that we have a working copy of TankStepped, we can begin to describe its input parameters. Unlike TankCalc, TankStepped is a relatively simple "command-line" application — its arguments are entered in sequence alongside the name of the program in a command shell (or alongside a prompt in one of the provided shell scripts), then the Enter key is pressed to acquire a result. Here are TankStepped's arguments as they would be entered in their proper sequence):
Entry Purpose Comment-v Program version Optional entry. Program exits after printing its version. -c Enable CSV data mode Optional entry. This "Comma Separated Values" mode produces data suitable for pasting into a database or spreadsheet program. r h Two numeric values representing a radius and a height for the bottom conical section. The first number pair defines the bottom tank section, normally a shallow inverted cone (see Figure 1). To define a tank with a flat bottom instead of an inverted cone, simply enter two zeros for this entry. r h Two numeric values representing a radius and a height for a cylindrical section. Any number of cylindrical sections may be entered, with different radii and heights. r h Two numeric values representing a radius and a height for the top spherical segment. To define a tank with a flat top instead of a spherical segment, enter two zeros. To enter the major radius of the sphere instead of the segment height, just enter the larger value and TankStepped will figure out your meaning (and read the discussion of "Spherical End Caps" on the TankCalc main page for more on this topic). n One numeric value representing either a table step value if negative, or an argument if positive. If presented with a small negative value, TankStepped will print a table of sensor heights and associated volumes using the value as an interval between table entries. Example: -0.5 will produce a table with 0.5 units between entries. If presented with a positive value, TankStepped interprets it as a height argument and computes the corresponding volume. Here is an example entry to TankStepped:
java -jar TankStepped.jar -c 16 0.5 16.1 2 16.2 3 16.3 4 16.4 6 16.5 25 -0.1In this entry, we have defined a tank with the following properties:
Entry Meaning-c This optional entry specifies the CSV (Commma-Separated-Value) output mode, suitable for exporting to a database or spreadsheet. 16 0.5 These two numbers specify the bottom section, an inverted cone, with a radius of 16 units and a height of 0.5 units. The user can disable the bottom cone profile by entering two zeros, resulting in a tank with a flat bottom. 16.1 2 These two numbers specify a cylindrical section with a radius of 16.1 units and a height of 2 units. 16.2 3 These two numbers specify a cylindrical section with a radius of 16.2 units and a height of 3 units. 16.3 4 These two numbers specify a cylindrical section with a radius of 16.3 units and a height of 4 units. 16.4 6 These two numbers specify a cylindrical section with a radius of 16.4 units and a height of 6 units. NOTE: Any number of cylindrical sections can be defined as above. 16.5 25 These two numbers specify a spherical segment top with a radius of 16.5 units and a spherical major radius of 25 units (a height can also be entered — see the "Spherical End Caps" discussion on the TankCalc main page for an explanation of this difference). The user can disable the top spherical profile by entering two zeros, resulting in a tank with a flat top. -0.1 This entry specifies an interval of 0.1 units between table rows (see below). If the program is given a negative number for the final entry as in the above example, TankStepped interprets it as a step value and creates a table of sensor heights and corresponding tank volumes using the provided numeric value as an interval between table entries. To increase the resolution of the table (and the number of table rows), simply make this number smaller.
If the program is given a positive number for the final entry, TankStepped interprets it as a height argument and creates a single volume result for that height.
Notice about the above example that each tank section has a separate radius entry — this is how TankStepped can create a very accurate volume profile for a tank with radii that differ from section to section.
Here are the equations TankStepped uses to compute volumes for the various sections of the modeled tank (remember that TankStepped acquires incremental volumes using special forms of these equations):
Section EquationBottom inverted cone Middle cylindrical sections Top spherical segment Here are some additional notes about TankStepped:
- For the TankStepped Java source file, click here.
- For a pretty-printed listing of the Java source, click here.
- Remember that TankStepped doesn't convert output volume units - the volume results are simply the input units cubed. To convert from cubic meters to liters, multiply by 1000. To convert from cubic inches to gallons, divide by 231. to convert from cubic feet to gallons, multiply by 7.4805.
- To acquire a full tank volume without generating a table, simply enter a very large value for the single-argument entry (as explained above) and TankStepped will print a value representing the tank's full volume.
- To capture the table output for use in another program using the clipboard:
- Windows:
- Click the upper left corner of the command window, choose "Edit ... Mark".
- Drag the mouse cursor across the desired table entries.
- Click the upper left corner of the command window, choose "Edit ... Copy".
- Move to the destination program, choose "Paste".
- Linux:
- In the command shell, drag the mouse cursor across the desired table entries.
- Right-click, select "Copy".
- Move to the destination program, choose "Paste".
- To feed a comma-separated-value table output directly into a file:
- java -jar TankStepped.jar -c (numeric entries) > filename.csv
- 03/16/2009 Version 1.1. Changed the format of the single-result output for greater consistency.
- 03/15/2009 Version 1.0. Initial Public Release.
Home | | Mathematics | | * Applied Mathematics | | * Storage Tank Modeling | | Share This Page |