This program will display a table of current liquid
volume in gallons for several standard sized fuel oil tanks based on
measured depth of remaining liquid.
Background & Techniques
There are many online tables listing gallons of liquid remaining in
specific sized tanks based on measured liquid depth. Most all of them
appear to be copied from the same source (or from copies of the copies). Several
anomalies appear in every version I have found. For example the 330 gallon
tank reports 330 gallons when the 44 inch dimension is vertical, but 322
gallons when laid on its side, i.e. with the 44" dimension horizontal. Not
that it is very significant, just unexplained.
This program reports 325 gallons in either orientation. I did make slight
adjustments to the dimensions for all tank sizes largely to
approximately match the numbers
published in the online charts. The 275 gallon tank for example, which has
nominal dimensions of 44"x27"x60", uses
44.6" x 27.1" x 60.7" dimensions during calculations.
All-in-all, writing the code was an interesting programming and math
Non-programmers are welcome to read on, but may
want to skip to the bottom of this page to download
executable version of the program.
Notes for Programmers
There are two basic tank shapes to handle; The
"racetrack" shape of the 275 and 330 gallon tanks has flat sides connected
by 27" diameter semi-circles for top and bottom profiles. Think of
them as 27" diameter cylinders split with a 27" x 17" rectangular solid
joining the two halves. The nominal length for the 275 gallon tank is 60"
and 72" for the 330 gallon version. The second shapes are cylindrical
solids in 500, 550, and 1000 gallon sizes all 48" in diameter and varying
only in length (65", 72", and 130"). The two smaller
oval tanks can
be oriented vertically 44" high and 27" wide, or lying flat with 27"
height and 44" width.
The tricky math bit is determining the area of the circular segment
formed by the bottom of the tank and liquid level when the depth is less
than the radius of the circle (13.5" or 24"). That area times the tank
length gives us the volume of the liquid in cubic inches. There are
exactly 231 cubic inches in a gallon so we now know the volume for any depth
in contact with the circular sides. The liquid in contact with the
flat sides is calculated as Height x Width x Length.
Program procedure FillGrid loops through all possible
depths from 1 to tank height by 1 inch increments. For each depth,
procedure GetCylidricalVolume is called to get
volume for depths in the curved portion of the tank and GetRectVolume
is called to get volume for the portion which is in the rectangular portion.
For depths less than the tank radius, GetCylindricalVolume works for
either shape and either orientation. For the oval tanks, GetRectVolume
for the submerged rectangular portion (if any) is added. For the
vertical oval tank or the cylindrical tank when liquid is deep enough to
reach into the top cylindrical part, I add the total upper cylindrical
volume and then use GetCylindricalVolume to calculate the air
space above the liquid and subtract that amount. Simple JPG images are displayed with each chart selected to show the type of
tank being evaluated.
February 20:, 2014: A viewer wrote asking for size charts for
two additional size variations for 275 gallon tanks (42x26x65, and 44x23x72).
While adding these sizes to make Version 2.1. I decided that, rather than
adjusting dimensions to produce the desired total volume, I would report the
"Actual" gallons remaining based on dimensions given and provide a second
"Nominal" column with those results scaled to make the total reported match the
nominal tank capacity.
March 6, 2014: Before leaving "Oil Tank" to rest in peace, I
decided to create Version 2.2 to allow users (and me) to define custom
sizes. (The first tank in the list now uses fractional inch measurements
for my tractor diesel fuel tank and actual now matches nominal volumes within a
gallon for any depth.) From there it was only a small step to allow
existing tank definitions to be edited or deleted. I also added the
ability to print the capacity charts. Most will require 2 pages to print
the entire list. They could be printed as two columns on a single page,
but I'm ready to move on and return later to finish the job. So it's "cut and
paste" for now to get a one page chart.
Suggestions for Further Explorations
I would like to locate the program which produces
the original of the tables that appear online and investigate why our
tables differ slightly. I have tried truncating or rounding fractional
gallons, and adjusting dimensions by fractional inches but never found the
combination that would produce an exact match across the entire range on
Two column chart printing would complete charts to
fit on a single page.
Original Date: October 25, 2010
February 18, 2016