Horizontal Tank Volume & Fill Level Calculator (LP-focused, temperature adjusted)

I have an LP tank that I monitor with the Mopeka integration. I’m sure thera re other similar propane tank monitors. Mine reports in inches, which has to be converted to a more useful measurement. Because of the complex geometry of horizontal tanks, this took some doing. I created an integration that can take any source measurement in distance and convert that into volume presuming your container is a horizontal cylinder with either flat or ellipsoidal endcaps. It exports both a fill level and volume in gallons. For use with liquids that expand, I’ve also included a temperature correction coefficient. By default, this is configured to temperature correct for LP to the standard measuring temperature of 60f. I used this to create a gauge and burn rate to populate my energy dashboard, but you can display this in any way you want.