Figure 1: Propane Tank Cutaway View
Several years ago I created a
Calculus tutorial, and I included a number of sample equations to show various properties of Calculus. One of the equations computed partial volumes for a cylindrical tank with spherical end caps (see figure 1 on this page). As it turns out, computing partial volumes for a horizontal tank is a common problem and, since the publication of the tutorial, I have gotten quite a few inquiries about it. So I have decided to return to this problem, add a few things, and make it a usable application of Calculus.
Many of my correspondents have relatively simple cylindrical tanks lying on their sides, and they need to know the relationship between the content height (as measured on a vertical axis in the tank) and the volume of the contents (the quantity held by the tank). Others have a tank like the one pictured on this page, with spherical end caps, typically used to store propane or natural gas, and they have the same requirement — what is the relationship between content height and the content volume?
Other correspondents have written to describe a third design, one I didn't know about, that has tank end caps that are curved but not spherical in cross section — I'll be calling this the "elliptical end cap" tank design. This sort of tank represents a compromise between fully spherical end caps (greatest resistance to bursting under pressure), and a simple cylinder with flat ends (most efficient use of space in a storage yard filled with tanks). The elliptical end cap design requires an equation I had not tried to write until now.
This article describes a general equation that can be used for all these tank types, and this page includes a calculator to produce practical results for user-entered tank measurements. This article is not a
tutorial that teaches Calculus, instead it is an
application of Calculus to a real-world problem. Those readers who would prefer an exposition on the topic of Calculus itself should read the
original tutorial before reading this article.
Examine Figure 2, a diagram of a typical storage tank. Notice that the diagram consists of a central cylindrical section and two elliptical end caps. This diagram contains most of the variable names and descriptions that will be used in this derivation:
|
L
|
The length of the cylindrical section.
|
|
R
|
The radius of the cylinder and the major radius of the elliptical end caps.
|
|
r
|
The minor radius of the elliptical end caps.
|
|
y
|
The height of the tank's contents.
|
|
e
|
The eccentricity of the end caps, equal to r/R.
|
While reading what follows, remind yourself that this is a flat diagram of a three-dimensional object. In particular note that
R, the radius of the cylinder and the major radius of the ellipses, describes a circular cross-section extending into a third dimension not shown in this diagram.
This article describes a procedure to compute a tank content volume if given
y, the content height within the tank. The first step is to write equations that can produce horizontal plane areas for the ellipses and for the cylinder, for a given
y height within the tank (once we have created the area equations, we will integrate them to get volumes).
Let's start with the ellipses, and for simplicity's sake, let's start out using a spherical cross-section (it's trivial to convert this to an elliptical spheroid later on). We need to get the area of a circle in the horizontal plane that slices through a sphere at a vertical position given by
y. For a sphere radius
R, such a function is:
|
(1)
|
|
Now let's integrate this circle area to get a partial sphere volume, and while we are about it, let's add a variable
e to handle the case of an elliptical spheroid:
|
(2)
|
|
Remember that the variable
e =
r/R, that is to say,
e is derived from two measurements made on the tank itself.
This completes the area of a spheroid with major radius
R and minor radius
r, between the bottom of the tank and any chosen
y value within the tank's volume. Remember that the two end caps can be calculated as a single spheroid that happens to be split in two, with half the volume at one end of the tank and half at the other.
Now let's turn to the cylindrical part of the tank. To begin this case, we need an equation that can produce a diameter line
d across the cylinder for a given
y value:
|
(3)
|
|
Now we must integrate between the bottom of the tank and this line to get the area
a of a partial circle, then multiply by the cylinder length
L to complete the partial volume of the cylinder:
|
(4)
|
|
At this point, we have created an equation (2) that will provide the volume of the two spherical parts of the tank (remembering that the two end caps, if combined, would equal a spheroid), and another equation (4) that provides the volume of the cylindrical part of the tank. Both equations use the same variable (
y) to determine the content height, so we should be able to combine these two equations to represent the complete tank partial volume:
|
(5)
|
|
Equation (5) will produce a partial volume for a given argument
y, for many kinds of storage tanks — from simple cylinders, through those with spheroidal end caps, to the classic spherical end caps as shown in Figure 1, even spherical tanks without any cylindrical section.
It will be seen that, for a cylindrical tank with flat end surfaces, the value of
r is zero and, because
e =
r/R,
e is therefore also zero. For a tank with spherical end caps such as is seen in Figure 1, the minor radius
r equals the major radius
R, and
e equals 1. This means one controls the type of tank being modeled by changing the input variables,
e in particular.
Here is an online computer based on the foregoing derivation.
This page provides a way to measure tank volumes for the common case of a partly filled cylindrical tank lying on its side. It can be used for tanks with flat ends (a classic cylinder), spherical ends such as are used to store propane and natural gas, and elliptical ends, that is, ends that are curved but not fully spherical. This page can also be used for spherical tanks — tanks with no cylindrical section.
This page should provide results of high accuracy (but read
this disclaimer) if the tank has been measured accurately. This page requires some tank dimensions to be able to compute volumes. Remember when measuring a tank that it is the
inside dimensions that determine the tank's volume. Some measurements will need to be corrected for the tank's wall thickness, therefore knowing the wall thickness is important for best accuracy.
All measured tank dimensions must be expressed in the same units of length (and they can be expressed in centimeters, meters, inches, or feet). The volume result can be expressed in a number of different ways, the only limitation is that the tank dimension set must be internally consistent.
Use this table to guide your measurement activity, and refer to Figure 2 above for definitions of the variables:
|
Variable name
|
Description
|
Notes
|
|
L
|
The length of the cylindrical section.
|
This measurement can be made without any correction for wall thickness. Many tanks have a weld line that separates the cylindrical section from the end caps. The L value is simply the linear distance between the weld lines.
|
|
R
|
The radius of the cylinder and the major radius of the elliptical end caps.
|
There are a number of ways to get this measurement. One way is to measure the tank's diameter and divide by 2. For some tanks, it will be easier ot measure the tank's circumference and divide by 2 π (6.283...). But remember to subtract the tank's wall thickness from the measured value as a final step.
|
|
r
|
The minor radius of the elliptical end caps.
|
If the tank has spherical end caps, simply use the R value acquired above for this measurement (because for a sphere all radii are equal). If the tank is cylindrical (flat end plates), set this value to zero. For tanks with curved but not spherical end caps, and for greatest volume accuracy, this measurement needs to be performed carefully. Again, even though it is not easy to make this measurement directly, there are a number of ways to get a reasonable value. One way is to measure the overall tank length, subtract the previously measured L value, and divide by 2. Another way is to use a plumb line and make marks on the ground, repeat this at the weld line, and take the difference. Remember to subtract the wall thickness before using the value.
|
|
y
|
The height of the tank's contents.
|
This value is normally acquired with integrated measurement equipment like a floating sensor or dipstick. This is the most frequently entered variable — it can be entered in the calculator display on this page, or it can be compared to a permanent table of values created with the database generator above.
|
Here is a list of tank types and how they are specified to the volume computer:
- Cylinder (flat ends). Set variable r to zero, R to the radius of the cylinder, and L to the length of the cylinder.
- Cylinder with spherical end caps. Set R to the radius of the tank's cylindrical section, set r = R, set L to the length of the cylindrical section.
- Cylinder with curved but not spherical end caps. Set R to the radius of the tank's cylindrical section, set r to the perpendicular radius (see Figure 2 above and see the measurement notes above), set L to the length of the cylindrical section.
- Spherical tank. Set both R and r to the radius of the sphere, set L to zero.
Here are some notes on the numerical range of the variables:
- By looking at Figure 2 near the top of this page, you can see that some of the variables have a very specific range, within which they produce meaningful results, and outside which they may produce error messages.
- Variable R, the tank radius, and variable L, the tank cylindrical length, don't have any innate limitations apart from the fact that they must be greater than or equal to zero.
- Variable r should fall in the range between zero and the value given to R.
- Variable e is derived, it is equal to r/R, therefore it should fall in the range between zero and one inclusive.
- Variable y should fall in the range between zero and 2 R inclusive, that is, it should not exceed the diameter of the tank. An error message will be printed if this range is exceeded.
Most of the variable values, and the chosen input and output units, are preserved between visits to this page.
Note on the database table output format:
The database generator has two output modes, HTML table and CSV (comma separated values) database. The HTML table is suitable for perusing by eye. The CSV output can be exported into a spreadsheet program for graphing or further processing, or it can be imported into a database. The output format is an industry standard portable data format that is accepted by many programs and database applications.
To copy the contents of the generated database, click the display with your mouse, press Ctrl+A to select the entire table, then Ctrl+C to copy it to the system clipboard.
This page's computation method and code is released under the GPL.
Here is a sample Java application listing that computes tank volumes using the method outlined on this page:
import java.io.*;
public class TankVolume {
static double tank_volume(double L,double R,double e,double y) {
double q = Math.sqrt((2 * R / y)-1);
double a = 2 * L * Math.atan2(1,q) * R * R;
double b = (e * Math.PI * (3 * R-y)* y*y) / 3.0;
double c = L * Math.sqrt((2 * R-y) * y) * (y-R);
return a + b + c;
}
static public void main(String[] args) throws Exception {
if(args.length != 4) {
System.out.println("Usage: L (cylinder length)");
System.out.println(" R (cylinder radius/ellipse major radius)");
System.out.println(" r (ellipse minor radius)");
System.out.println(" y (content height, max 2R)");
System.out.println(" All consistent units.");
System.out.println("Result: tank partial content volume in units^3.");
}
else {
double L = Double.parseDouble(args[0]);
double R = Double.parseDouble(args[1]);
double r = Double.parseDouble(args[2]);
double e = r/R;
double y = Double.parseDouble(args[3]);
double v = tank_volume(L,R,e,y);
System.out.println("Tank partial volume: " + v);
}
}
};
This Java application produces a volume result expressed in the input units cubed (e.g. if the input is expressed in inches, the output is expressed in cubic inches).
Click here to download an example Excel spreadsheet that computes tank volumes using the mathematical method described above.
The spreadsheet uses multiple copies of the cell content listed below, plus some variables defined in the spreadsheet, to create a table of volumes for corresponding Y values:
=F*(2*L*ATAN2(SQRT((2*R/A14)-1);1)*R*R+(e*PI()*(3*R-A14)*A14*A14)/3+L*SQRT((2*R-A14)*A14)*(A14-R))
Where:
|
L,R,e
|
Variables described in the above article and defined in the spreadsheet.
|
|
F
|
A volume conversion factor, also defined in the spreadsheet. A typical value is 1/231, to convert cubic inches to gallons.
|
|
A14
|
An arbitrary cell address containing a value for Y. Change this address as required and note that it appears multiple times in the equation.
|
To use the spreadsheet, create a column of Y values that meets your range requirements and place a copy of the above cell contents adjacent to each Y value. Change the relative address "A14" to the actual address required. The
spreadsheet should serve as an example of how this is done.
What about an ellipsoidal cylinder?
I wondered if your formula could be easily adapted to cover the case of the parallel section being ellipsoidal instead of cylindrical as is the case with modern fuel bowsers.
Do you mean a cylinder lying on its side, whose width is greater than its height? Yes, that case can be handled easily.
Just take all the tank's dimensions, but proceed as though the tank was a simple cylinder, using the cylinder's height as the diameter in my equations. Then, when you have gotten a result volume from my equations, multiply by the ratio of the width to the height.
Example. Let's say you have a tank that has a height of 48 inches, but a width in cross-section of 56 inches. Go through all the computations using 48 inches as the tank diameter. Then, for each result volume, multiply by the ratio of 56/48. This works for any partial volume result.
This idea works because the volume of an ellipsoidal cylinder of the kind we're speaking of is equal to π * r1 * r2 * h, where r1 and r2 are the two differing radii of the tank (in the above example, they would equal 24 and 28 inches).
Be sure to test your implementation of this procedure, comparing the results with some other source of information, to make sure you are carrying it out correctly.
I apologize for the strict legalese below, but this article's calculations may be used to design and maintain fuel tanks and the possibilities for litigation have not escaped my attention. Sorry.
Disclaimer of Warranty
The computations provided on this page are provided on an "as-is" basis, without warranty of any kind, including without limitation the warranties of merchantability, fitness for a particular purpose and non-infringement. The entire risk as to the quality and performance of the computations provided on this page is borne by you. Should the results prove to be in error, you assume the entire cost of any required service and repair, and any consequential damage.
Limitation of Liability
As customary in the computer business, you are solely responsible for any loss of profit or any other commercial damage, including but not limited to special, incidental, consequential or other damages. This disclaimer specifically disclaims all other warranties, expressed or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose, related to defects in the computed results or the documentation.