Harrisoncw: Be warned that the SLC500 does trig in radians. Make sure you account for that in your program.
Ron, pi times r-squared times height works for vertical cylindrical tanks. But horizontal cylindrical tanks are another matter. We need to calculate the area between the circle defined by the tank walls and the cord as defined by the top surface of the liquid. Then multiply this by the lenght of the cylinder. The equations you linked at mathforum is a great one for a horizontal tank with domed ends. I'm going to hang on to that one just in case I ever need it so I don't have to work out the equation my self.
--------------------------------------
For vertical cylindrical tanks with domed bottoms or conical bottoms then the solution is a two part solution. For low tank levels where h is defined as being below the cylinder and in the dome or cone then we can use simple volume of a cone equations or volume of a sphere/ellipsoid equations. For values of h where h is above the dome/cone and in the cylindrical section, we can use pi*r^2*h + the known volume of the dome/cone.
Also in a PLC its a good idea to avoid unnecessary mathematical computations. Quantities that are fixed, such as the cross sectonal area of a vertical cylindrical tank should be precalculated - not re-calculated by the PLC every scan. Thus for a 24 inch diameter vertical tank the area is 452.4 sq. inches. Use this area value times the height. Likewise for a horizontal tank, the values for pi*r^2/2, r^2, and 2r are unchanging. Don't make the PLC recalculate these every time.