Automation

Tank volume and level calculator

Turn a measured level into litres for a horizontal cylinder, a vertical cylinder or a rectangular tank: capacity, volume and mass at the level, the 4–20 mA the transmitter gives, the error a linear PLC scaling makes on a horizontal tank, and a strapping table to load into the PLC.

Tank, level and signal
Dished or conical ends are not modelled; see the limitations.
Inside diameter of a horizontal or vertical cylinder.
For a horizontal cylinder the length of the shell between the ends; otherwise the inside height.
What the level transmitter reports, measured from the inside bottom of the tank.
Water 1.0; diesel 0.84; petrol 0.74; milk 1.03; 98 % sulphuric acid 1.83. Used for the mass only.
Equal level steps from empty to full; the table has one more row than steps.

Volume and level

Enter your values and press Calculate.

What the calculator does

A level transmitter reports a height. The operator, the batch recipe and the stock count want litres. For a vertical cylinder or a rectangular tank the two are proportional and a PLC's linear scaling block does the job; for a horizontal cylinder they are not, because the tank is narrow at the bottom, widest at the middle and narrow again at the top, so the same 10 cm of level is a different number of litres at every height. The calculator takes the tank dimensions and the level and returns the capacity, the volume and mass at that level, how full the tank is by volume and by height, the 4–20 mA the transmitter produces for either scaling convention, and, for a horizontal tank, how far a straight-line scaling would be out at that level.

It also builds a strapping table: the volume at equal level steps from empty to full, which is what a PLC interpolates between when the segment formula is not available in its instruction set. It applies to fuel tanks, water tanks, chemical day tanks and milk silos; and it applies equally when the tank is being emptied, where the question is how many litres are left before the pump runs dry.

Formula

Horizontal cylinder with flat ends, inside radius r = D ÷ 2, shell length L and level h measured from the bottom (0 ≤ h ≤ D). The wetted area of the end is a circular segment:

A = r² × acos((r − h) ÷ r) − (r − h) × √(2 r h − h²)
V = A × L Vtotal = π r² L

The segment is a sector minus a triangle. The chord at the liquid surface subtends an angle 2θ at the centre, where θ = acos((r − h) ÷ r); the sector between the two radii has area r² θ; and the triangle formed by the centre and the chord has base 2 √(2 r h − h²) and height (r − h), so its area is (r − h) √(2 r h − h²). Below half full the triangle is subtracted from the sector; above half full (r − h) is negative, the expression adds the triangle, and the formula still holds without a special case. At h = r it gives half the circle, at h = D the whole circle.

Vertical cylinder of radius r and height H, and rectangular tank of length Lr, width W and height H, both with a flat bottom:

V = π r² h Vtotal = π r² H
V = Lr × W × h Vtotal = Lr × W × H

The rest is bookkeeping. Mass m = 1 000 × SG × V kilograms with V in cubic metres. The transmitter current is I = 4 + 16 × f milliamps, where f is h ÷ H if the transmitter is scaled to level, or V ÷ Vtotal if the transmitter or the PLC is scaled to volume. The linear-scaling error is what a PLC reports when it multiplies the level fraction by the capacity, (h ÷ H) × Vtotal, minus the true volume V. The strapping table evaluates V at equal steps of h from 0 to H.

Worked example

A horizontal diesel day tank in a generator room: 2.0 m diameter, 3.0 m long, flat ends. The hydrostatic transmitter reads 0.8 m; it is scaled to level. Specific gravity 1.0 is left in place so the mass reads directly in litres of water; for diesel use 0.84.

  1. r = 1.0 m, (r − h) ÷ r = 0.2, acos(0.2) = 1.3694 rad (78.5°).
  2. 2 r h − h² = 1.6 − 0.64 = 0.96, √0.96 = 0.9798, and (r − h) × 0.9798 = 0.1960.
  3. A = 1.0 × 1.3694 − 0.1960 = 1.1735 m².
  4. V = 1.1735 × 3.0 = 3.520 m³ = 3 520 L. Capacity = π × 1.0² × 3.0 = 9.425 m³ = 9 425 L, so the tank is 37.4 % full by volume at 40 % of its diameter, with 5 904 L of space left.
  5. Mass = 3.520 × 1 000 × 1.0 = 3 520 kg (3.52 t).
  6. Transmitter scaled to level: 4 + 16 × 0.40 = 10.40 mA. If it were scaled to volume it would give 4 + 16 × 0.3735 = 9.98 mA for the same liquid.
  7. A PLC that scales the level straight into litres reports 0.40 × 9 425 = 3 770 L, which is 249 L (7.1 %) more than is in the tank. On this tank the gap between the straight line and the true curve reaches 5.8 % of capacity, 544 L, near 20 % and 80 % of the diameter.

The calculator reproduces these figures with its default inputs and prints the strapping table below at 0.2 m steps.

Strapping table for the example tank

Level (m)Level %Volume (L)Volume %mA (level)
0.000 %00.0 %4.00
0.2010 %4915.2 %5.60
0.4020 %1 34214.2 %7.20
0.6030 %2 37825.2 %8.80
0.8040 %3 52037.4 %10.40
1.0050 %4 71250.0 %12.00
1.2060 %5 90462.6 %13.60
1.4070 %7 04774.8 %15.20
1.6080 %8 08385.8 %16.80
1.8090 %8 93494.8 %18.40
2.00100 %9 425100.0 %20.00

Horizontal cylinder, D = 2.0 m, L = 3.0 m, flat ends. The level column is what the transmitter reports and the mA column is its output when scaled to level; the volume column is what the PLC should display. Linear interpolation between these eleven rows is never more than 70 L (0.7 % of capacity) from the exact formula; 21 rows bring that to 26 L (0.3 %).

Assumptions and limitations

  • Flat ends. Most horizontal tanks have dished ends, and they hold liquid. A 2:1 semi-elliptical head holds π D³ ÷ 24, which is 1.047 m³ each on a 2 m tank, so the example tank with two of them holds 11.5 m³, 22 % more than the 9.42 m³ the calculator gives, and the heads fill on a curve of their own. Torispherical heads hold less, conical ends and sumps something else again. For stock control or custody transfer use the maker's strapping table or a calibration to ISO 12917-1; use this calculator for the shell and treat the ends as a separate term.
  • The tank is level. A 1° tilt along a 3 m tank moves the liquid surface 5.2 cm from one end to the other, and the transmitter reads the level at its own position, not the mean. Tanks on saddles settle; check with a spirit level before trusting the low-level readings.
  • The transmitter reads a level, not a volume, and each type reads it differently. A hydrostatic transmitter measures pressure and divides by ρ g, so a change of specific gravity changes the level it reports: diesel at SG 0.84 in a transmitter calibrated for water reads 16 % low. An ultrasonic or radar transmitter measures the distance from its face down to the surface, so the reference height it is programmed with must be the true inside height at the mounting nozzle. A float measures its own immersion. See the level measurement guide.
  • Temperature. Density and volume both move with temperature: water is 1.5 % less dense at 60 °C than at 20 °C, and a hydrocarbon expands by roughly 0.1 % per degree. The calculator uses one specific gravity at one temperature.
  • Dead volume. Whatever sits below the outlet, or below the transmitter's zero, is in the tank but not available. Sludge and sediment occupy volume the table credits to liquid. Subtract the dead volume when the question is how much can be pumped out.
  • The PLC's scaling block is linear. A horizontal tank needs either the segment formula, which structured text can evaluate directly (A := R*R*ACOS((R-H)/R) - (R-H)*SQRT(2.0*R*H - H*H)), or a strapping table with interpolation. For the example tank a table of ten steps interpolates to within 0.7 % of capacity and twenty steps to within 0.3 %, both well inside what a level transmitter delivers.
  • Inside dimensions. Use the inside diameter and the shell length between the ends, not the nameplate overall dimensions; wall thickness on a 2 m tank is a few millimetres, a dished end can be 500 mm.

Frequently asked questions

Why is a horizontal tank half full at half its height but only 37 % full at 40 %?

Because the width of the liquid surface changes with the level. Near the bottom the chord is short, so a centimetre of level is few litres; at the centreline the chord is the full diameter, so a centimetre is the most litres it can ever be; near the top it narrows again. Volume against level is therefore an S-curve that is flat at both ends and steepest in the middle, and it crosses the straight line only at empty, half and full. At 40 % of the diameter the tank is 37.4 % full; at 20 % it is 14.2 % full; at 80 % it is 85.8 % full.

What is a strapping table?

A table of volume against level for one particular tank, originally produced by "strapping": measuring the tank's circumference with a tape at intervals along its length and computing the volume from the measurements, with corrections for plate thickness, the ends, tilt and internal fittings. Tank makers and calibration contractors issue one for every tank used in custody transfer, at 1 cm or 1 mm increments. The calculator's table is the geometric version for a flat-ended shell; a PLC uses either kind the same way, by interpolating between the two rows that bracket the measured level.

Hydrostatic, ultrasonic, radar or float: which transmitter?

Hydrostatic (a pressure transmitter at the bottom or a submersible probe) is cheap, robust and indifferent to foam and vapour, but it reports pressure, so it needs the liquid's density and it drifts if the density changes. Ultrasonic is non-contact and easy to fit through a top nozzle, but foam absorbs the echo, vapour and temperature change the speed of sound, agitation scatters the pulse, and the first 25–50 cm below the face is a dead zone. Radar (free-space or guided-wave) is non-contact, unaffected by vapour, pressure and most foam, accurate to a few millimetres, and now cheap enough for ordinary tanks; guided-wave radar copes with small tanks, low-dielectric liquids and interfaces. A float is simple and needs no power, but it sticks in sludge and viscous liquids and wears. All four report a level, and the volume is a calculation that follows.

How do I put the volume calculation into the PLC?

Two ways. If the PLC has trigonometric functions (most IEC 61131-3 controllers with structured text do), compute the segment area from the level with the formula above, multiply by the length and add any end-volume term. If it does not, or the tank has dished ends and a maker's table, store the table as two arrays, find the two rows that bracket the measured level, and interpolate linearly between them. Keep the table in retentive memory or in a recipe so that a CPU replacement or a tank change does not mean re-typing it, and display the level as well as the volume so that a disagreement between the two is visible.

How can the PLC tell that the transmitter is stuck?

A level that does not move while the pump is running is the usual sign: if the fill pump has run for ten minutes and the level has not changed by the amount its flow rate predicts, alarm. A rate-of-change check catches the opposite fault, a reading that jumps faster than any pump could fill or empty the tank. A reading pinned at exactly 4.00 or 20.00 mA, or outside 3.8–20.5 mA, means a saturated or failed loop rather than a real level (NAMUR NE 43). None of these checks costs more than a few lines of logic, and they are the difference between a level system and a level display.

What about a sump or a pit that is not a regular shape?

Calibrate it by filling. Empty it, then fill it at a known flow rate, or with a flow meter, or bucket by bucket for a small one, and record the level at each known volume. That gives a strapping table for the real shape, including the pump, the pipework and whatever else takes up room, and it is the same table the PLC would use for a horizontal tank. Repeat it if the pit is modified, and note the date on the table.

References

  • ISO 12917-1:2002, Petroleum and liquid petroleum products — Calibration of horizontal cylindrical tanks — Part 1: Manual methods — also published as API MPMS Chapter 2.2E; strapping, end corrections, tilt and deadwood
  • API Manual of Petroleum Measurement Standards, Chapter 2: Tank Calibration — upright and horizontal tanks, calibration tables
  • API Standard 2350, Overfill Prevention for Storage Tanks in Petroleum Facilities, 5th edition, 2020 — independent high-high level detection and levels of concern
  • NAMUR NE 43 (2003), Standardization of the signal level for the failure information of digital transmitters — a level reading outside 3.8–20.5 mA is a fault, not a level
  • Manufacturer's operating instructions for the level transmitter installed — blocking distance, mounting rules, density setting, linearisation table capacity and output scaling

Last reviewed 2026-09-20.