Keg Volume Calculator

Homebrew Talk - Beer, Wine, Mead, & Cider Brewing Discussion Forum

Help Support Homebrew Talk - Beer, Wine, Mead, & Cider Brewing Discussion Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.

kaljade

Well-Known Member
Joined
Aug 14, 2015
Messages
352
Reaction score
69
Location
Bathurst
Hi all,

This is my second thread as thanks to the assistance of the amazing ajdelange in my first thread I was finally able to add the finishing touches to my long neglected Keg Volume Calculator (be advised that the Carbonation Calculator in my first thread is still very much a work in progress but for all intents and purposes here it is accurate enough).

If you just want the spreadsheet rather than reading on you can download my Keg Volume Calculator here.

Otherwise, once again, thanks for stopping by!

So my journey began here on HomeBrewTalk.com in the RaspberryPints - Digital Taplist Solution thread (which I invite everyone who hasn't already seen it to take a look), which now that I have set up is absolutely fabulous for tracking keg volume under normal circumstances (if you start with a completely full keg and you have no phantom pours, premature kicks, etc), but what happens when circumstances go outside of the norm? Well you can join the rest of the planet that do not have flow meters on their kegs, or you can use the new and improved Keg Volume Calculator.

So the base formula comes from a post in the RaspberryPints thread by DrunkleJon:

Personally, I have been guessing. Otherwise you can do a little math.

Weight of keg with beer - Weight of empty keg = FG of beer * weight of volume as water
so
(Weight of keg with beer - Weight of empty keg)/FG of beer = (Gallons of beer in keg / 8.34)
since 1 gallon of water is 8.34 pounds

Should work pretty well.

So armed with that I just expanded it to include a VLOOKUP table to allow for water density changes according to temperature, so all you needed to do was weigh your keg (before and after), enter in the temperature and final gravity and it would do the rest. The only caveat was of course that it was based on the pressure being a standard atmosphere (pretty big caveat if you've read my first thread).

Enter version two: "to allow for pressure/altitude (not that it makes a huge difference on the volumes we are using, but for the sake of accuracy, scalability and to satisfy my inner pedant), and also to select between metric and imperial units.", so now we were getting closer with the exception of Henry's Law of course:

"In chemistry, Henry's law is a gas law that states that the amount of dissolved gas is proportional to its partial pressure in the gas phase. The proportionality factor is called the Henry's law constant. It was formulated by the English chemist William Henry, who studied the topic in the early 19th century."

So the final piece in the puzzle was being able to allow for the weight of the dissolved CO2, which began an entirely new journey of incorrect assumptions, followed by the patient guidance of ajdelange (further details in the other thread so I won't bore you all with the details again), which brings me here.

So in a nutshell here's how it works:
  • Calculate the weight of the beer less the keg
  • Calculate the volume of pure water at the same weight and temperature
  • Adjust based on absolute pressure: gauge pressure (at equilibrium) plus barometric pressure
  • Adjust the volume based on the gravity of the beer
  • Calculate the weight of CO2 dissolved in the beer
  • Adjust the volume based on the weight of the dissolved CO2
Simple enough, so how do I use it?
  1. Enter your measurements in column B
  2. Select you units of measurement from the dropdowns in column C (see screenshot)
  3. Note: Gauge pressure is only required if it is already force carbonated, if it's a new keg ensure row 6 is set to 0 psi/kPa
2017-08-09_1022-68301.png


So, good people, please road test it for me and let me know if it is of value or not, and any suggestions/corrections/criticisms are always welcome.

More information on the above can be located at the following links:

Better Carbonation Calculator (hopefully) thread

[Version 2 Release] RaspberryPints - Digital Taplist Solution thread

https://www.simetric.co.uk/si_water.htm

http://www.wetnewf.org/pdfs/Brewing_articles/CO2%20Volumes.pdf

Keg Volume Calculator
 
Last edited:
Man, some of these beer spreadsheets are loaded with cells that use a crapload of conditionals.
I'll have to try this one on LibreOffice.

[edit] Works great! Love the user configurables - I'm stuck in Imperial Land :)
I love it! I will definitely give this another go next time I load a keg.

I have all 16 kegs serialized and their tare weights recorded, so when I load a keg in my keezer I can give my R'Pints system the volume based on net weight - but using first-order only (ie: just the net weight/(SG * 8.345 lbs).
Not sure the second/third order effects will amount to a large error - right now I kick kegs within a pour of RaspberryPints' prediction...

Cheers!
 
Man, some of these beer spreadsheets are loaded with cells that use a crapload of conditionals.
I'll have to try this one on LibreOffice.

[edit] Works great! Love the user configurables - I'm stuck in Imperial Land :)
I love it! I will definitely give this another go next time I load a keg.

I have all 16 kegs serialized and their tare weights recorded, so when I load a keg in my keezer I can give my R'Pints system the volume based on net weight - but using first-order only (ie: just the net weight/(SG * 8.345 lbs).
Not sure the second/third order effects will amount to a large error - right now I kick kegs within a pour of RaspberryPints' prediction...

Cheers!

All good, in all reality the accuracy of the spreadsheet is probably negated by the accuracy of the scales we weigh the kegs on, but you are only as strong as your weakest link so if they are all weak...

Happy to give something back, after all I've taken.

Cheers,

Kal
 
It's a solid effort and being a life long techo-dweeb I appreciate it :mug:

Comparing the spreadsheet results to my simple calculus shows temperature is the second order metric - and the spreadsheet illustrates a decent error extant in my math when kegging from a crashed carboy: 8.345 lbs/gallon is only good around room temperature :)

At 36°F with everything else equal the volume difference is over 3 ounces - not a game changer or anything but still significant.

Cool! I already enjoy Keg Roulette with my taplist, this will heighten the drama a little bit more ;)

Cheers!
 
It's a solid effort and being a life long techo-dweeb I appreciate it :mug:

Comparing the spreadsheet results to my simple calculus shows temperature is the second order metric - and the spreadsheet illustrates a decent error extant in my math when kegging from a crashed carboy: 8.345 lbs/gallon is only good around room temperature :)

At 36°F with everything else equal the volume difference is over 3 ounces - not a game changer or anything but still significant.

Cool! I already enjoy Keg Roulette with my taplist, this will heighten the drama a little bit more ;)

Cheers!

It is possible there are errors in my calculations so this is why I appreciate people like yourself (and myself of course) road testing it against something like R'Pints. I'm happy to implement any suggested improvements (but most of the fun is in the actual testing anyway).

Cheers,

Kal
 
The SF800 meters I run are rated at 1% accuracy/0.3 % reproducibility.
So a 3 ounce error over nearly 5 gallons would bump the accuracy to around 1.5%.
Not likely discernible, but otoh, just knowing that's out there bugs me now - I'll use your spreadsheet just on GPs :)

Cheers! :mug:
 
The SF800 meters I run are rated at 1% accuracy/0.3 % reproducibility.
So a 3 ounce error over nearly 5 gallons would bump the accuracy to around 1.5%.
Not likely discernible, but otoh, just knowing that's out there bugs me now - I'll use your spreadsheet just on GPs :)

Cheers! :mug:

I'll take another look at my calculations when I finish my real job for the day (only 11:14am here at the moment).

I also use the SF800 meters so if they are out I'll also notice it as they are pretty much spot on with a full keg.

Thanks for the feedback.

Cheers,

Kal
 
I think you're missing my point: your spreadsheet is more accurate than the simple math I've been using, mostly due to the temperature compensation...

Cheers!
 
I think you're missing my point: your spreadsheet is more accurate than the simple math I've been using, mostly due to the temperature compensation...

Cheers!

Right you are I did completely miss your point, apologies for that, cheers! :)

That said 3 ounces still seems a little high for only a temperature change, is you gauge pressure set to 0 psi?
 
Empty Keg Weight 9#
Current Keg Weight 50#
Keg Temperature 36°F
Gauge Pressure 11 psi
Altitude 200 ft ASL
Beer Gravity 1.012

Keg Volume 4.830 gallons

Otoh, using the simple (Current Keg Wt - Empty Wt)/(SG * 8.345#) yields 4.855 gallons.
The .025 gallon difference = 3.2 ounces.
Clearly the simple path lacks the influence of many metrics...

Cheers!
 
Empty Keg Weight 9#
Current Keg Weight 50#
Keg Temperature 36°F
Gauge Pressure 11 psi
Altitude 200 ft ASL
Beer Gravity 1.012

Keg Volume 4.830 gallons

Otoh, using the simple (Current Keg Wt - Empty Wt)/(SG * 8.345#) yields 4.855 gallons.
The .025 gallon difference = 3.2 ounces.
Clearly the simple path lacks the influence of many metrics...

Cheers!

Bingo! Gauge pressure is definitely a contributing factor then, as with all other values the same but gauge pressure = 0 psi you get 4.841 gallons which is only a difference of 1.8 ounces, so although temperature does play a role it is compounded by the weight of the dissolved CO2

I've updated the original post to indicate gauge pressure is at equilibrium so therefore not required on a new keg (unless you force carbonate it before you weigh it).

Of course there is dissolved CO2 in the beer before we force carbonate, so maybe I need to factor that in as well...
 
This is great, thanks for cranking out all the math. It passes the sniff test for me and I'd like to think I'm a smart guy so I'll use it exactly as you constructed it! (ha just kudos to you really)

Heres how I'm using it and I'll add in a few points from my user experience:
I've been bulk aging a big Belgian for the last 6 months in a keg. I knew it was something like 4gallons going in (based on measurements from the fermenter) but I want to know the exact amount. With the exact amount I'll be able to add priming sugar to the keg and bottle directly off the keg (instead of transferring to bottling bucket).

I'm using an empty corny keg weight of exactly 9 lbs. (confirmed by others, not by me)
I asked siri my current elevation and it gave it to me to the foot.
I'm using 3psi for gauge pressure even though I have been off gassing the keg bc i figure this will account for a little bit of dissolved co2 left -- I'd appreciate any guidance here.

so plugged it all in and 43.2 lbs got me 4.05 gallons of beer. Will confirm at time of bottling.

THANKS a lot!!
 
This is great, thanks for cranking out all the math. It passes the sniff test for me and I'd like to think I'm a smart guy so I'll use it exactly as you constructed it! (ha just kudos to you really)

Heres how I'm using it and I'll add in a few points from my user experience:
I've been bulk aging a big Belgian for the last 6 months in a keg. I knew it was something like 4gallons going in (based on measurements from the fermenter) but I want to know the exact amount. With the exact amount I'll be able to add priming sugar to the keg and bottle directly off the keg (instead of transferring to bottling bucket).

I'm using an empty corny keg weight of exactly 9 lbs. (confirmed by others, not by me)
I asked siri my current elevation and it gave it to me to the foot.
I'm using 3psi for gauge pressure even though I have been off gassing the keg bc i figure this will account for a little bit of dissolved co2 left -- I'd appreciate any guidance here.

so plugged it all in and 43.2 lbs got me 4.05 gallons of beer. Will confirm at time of bottling.

THANKS a lot!!
Thank you, glad you like it!

As the calculator takes disolved CO2 weight into account, it will need to be at equalibrium for that to be accurate, so you'll need to reduce the CO2 in your calculations every couple of days after you degas.

That said it'll still be "close enough" for most intents and purposes, I'm just a bit of a pedant (which is not that uncommon in this hobby).

Cheers,

Kal
 
So armed with that I just expanded it to include a VLOOKUP table to allow for water density changes according to temperature,

No need for tables. The following polynomial gives rms residual of 3E-7 with respect to the data in the table from
Bettin, H.; Spieweck,F.: "Die Dichte des Wassers als Funktion der Temperatur nach Einführung der Internationalen Temperaturskala von 1990. PTB-Mitt. 100 (1990) pg 195-196

density = 0.99984+T*(6.7715e-05-T*(+9.0735e-06-T*(1.015e-07-T*(+1.3356e-09-T*(1.4421e-11-T*(+1.0896e-13-T*(4.9038e-16-9.7531e-19*T))))))) gram/cc.

Just paste that into your spreadsheet and change the eight T's to the address of the cell containing the Centigrade temperature (ITS 90).

The density of water at 20 °C is 0.998203 g/cc and at 30 °C is 0.995645 according to the Bettin/Spieweck table. The polynomial returns 0.99820298 and 0.995645047 respectively.
 
Last edited:
No need for tables. The following polynomial gives rms residual of 3E-7 with respect to the data in the table from
Bettin, H.; Spieweck,F.: "Die Dichte des Wassers als Funktion der Temperatur nach Einführung der Internationalen Temperaturskala von 1990. PTB-Mitt. 100 (1990) pg 195-196

density = 0.99984+T*(6.7715e-05-T*(+9.0735e-06-T*(1.015e-07-T*(+1.3356e-09-T*(1.4421e-11-T*(+1.0896e-13-T*(4.9038e-16-9.7531e-19*T))))))) gram/cc.

Just paste that into your spreadsheet and change the eight T's to the address of the cell containing the Centigrade temperature (ITS 90).

The density of water at 20 °C is 0.998203 g/cc and at 30 °C is 0.995645 according to the Bettin/Spieweck table. The polynomial returns 0.99820298 and 0.995645047 respectively.
Thanks AJ!

You are a god amounst men, and never fail to impress me with your knowledge of such things.

I'll fold that into my spreadsheet, which should remove the current upper/lower temperature limits of the table.

I'll report back when that's done.

Cheers,

Kal
 
Finally had time to update the calculator with the polynomial supplied by @ajdelange

Happy for any testers out there to give it a go, due to the number of significant figures in the final volume calculation you probably won't be able to tell much of a difference from the previous version, but there are now no upper/lower temperature range limits as it no longer relies on a VLOOKUP.

Thanks again to @ajdelange for the use of your enormous brain and the generosity to share here!

Cheers,

Kal
 
While working on incorporating this functionality into RPints, I discovered an error in one of the cells that calculates the weight of dissolved CO2 (so only slightly impacts it which is why I never noticed it before). I've fixed it now and uploaded a new version. Apologies for any inaccuracy caused.

Cheers,

Kal
 
I was curious of how you came up with the RPints code (more or less what the constants were) so I looked into your workbook (forgive me, excel protection is easy to bypass) and noticed something that didn't seem right with temperature

for Celsius (Sheet2!B11) you are taking sheet1!B5 and converting it to Celsius, but I could change the label in Sheet1!C5 to Celsius then that formula because invalid because it is putting Celsius into the Fahrenheit field. I tested by 2.222 in the keg temp and changing the label to Celsius and the Keg volume changed

Shouldn't Sheet2 B11 be the conditional: if sheet1!C5 is Fahrenheit then convert Sheet1!B5 to Celsius else use Sheet1!B5 as is.
Then Sheet2 B9 should be equal to B10 since you always want that to be Fahrenheit
 
I was curious of how you came up with the RPints code (more or less what the constants were) so I looked into your workbook (forgive me, excel protection is easy to bypass) and noticed something that didn't seem right with temperature

for Celsius (Sheet2!B11) you are taking sheet1!B5 and converting it to Celsius, but I could change the label in Sheet1!C5 to Celsius then that formula because invalid because it is putting Celsius into the Fahrenheit field. I tested by 2.222 in the keg temp and changing the label to Celsius and the Keg volume changed

Shouldn't Sheet2 B11 be the conditional: if sheet1!C5 is Fahrenheit then convert Sheet1!B5 to Celsius else use Sheet1!B5 as is.
Then Sheet2 B9 should be equal to B10 since you always want that to be Fahrenheit
All good, the protection is there to stop people inadvertantly breaking any formulas, not to hide any trade secrets, if you can bypass it you clearly know what you are doing. I did discover that when I was working on the RPints version, and thought I'd fixed it, like I said above it only impacted the volumes of CO2 so didn't greatly impact the results, and I only noticed it in the RPints version because I always used metric myself. How long ago did you download it, maybe I uploaded the wrong version?

Also I put comments next to all of the JavaScript/jQuery in the tap_form.php file if you want to incorporate it into your version.

Cheers,

Kal
 
How long ago did you download it, maybe I uploaded the wrong version?

Also I put comments next to all of the JavaScript/jQuery in the tap_form.php file if you want to incorporate it into your version.

I downloaded it this morning from https://goo.gl/nvwdEF (found in your original post)

I was looking to add it to my version but wanted to make it handle the conversions between imperial and metric based on a flag passed to a function so I needed to know what was metric and what was imperial and didn't want to miss an inline conversion.

I'm going to use it to setup a foundation that if someone would get scale data (real time weight) into the pi they could call an update function and it would calculate the new volume based on that.
 
I downloaded it this morning from https://goo.gl/nvwdEF (found in your original post)

I was looking to add it to my version but wanted to make it handle the conversions between imperial and metric based on a flag passed to a function so I needed to know what was metric and what was imperial and didn't want to miss an inline conversion.

I'm going to use it to setup a foundation that if someone would get scale data (real time weight) into the pi they could call an update function and it would calculate the new volume based on that.
Nice! Right you are the version still has the wrong cell for temp, nice catch!

I'm sure you can do much better in RPints than I did, I'm definitely not a software engineer, but I wholeheartedly welcome you improving it as I always felt it was a missing feature, that had real world uses.

I'll find and upload the fixed version shortly, but sounds like you've already got everything you need.

Cheers!
 
I downloaded it this morning from https://goo.gl/nvwdEF (found in your original post)

I was looking to add it to my version but wanted to make it handle the conversions between imperial and metric based on a flag passed to a function so I needed to know what was metric and what was imperial and didn't want to miss an inline conversion.

I'm going to use it to setup a foundation that if someone would get scale data (real time weight) into the pi they could call an update function and it would calculate the new volume based on that.
BTW, one other thing I would have liked to do but didn't have the coding chops for, was auto-update keg maxVolume if start amount was greater that maxVolume, saving you having to manually update (kinda "self learning").

Cheers,

Kal
 
auto-update keg maxVolume if start amount was greater that maxVolume, saving you having to manually update (kinda "self learning")

I will put that in, if I remember when I incorporate your max volume changes.
 
Updated version now up (MD5 checksum: 1a2087935b4496aa5dc9d43063696f24 to make sure you have the right version).

Thanks again @RandR+ for the sleuthing!

Cheers,

Kal
 
Whats the password to unlock the sheet? I want to double check your formulas.
I won't give out passwords, but if you read this thread and the carbonation calculator thread referenced in the first post you'll see them throughout. Alternatively if you can wait a week I'll post a link to an unlocked version when I'm back at my local machine.
 
Last edited:
Not a problem - i am halfway to developing my own. It's not like Henry's law is a secret. Have the temperature compensated Henry's law coefficient as it relates to the Van'tHoff equations programmed in already. I'll run as an independent test of yours.
Read the carbonation calculator thread and you'll discover as I did that beer doesn't behave the same as water so your equation will have an error margin of about 5% at SG 1.015.

My calculator has been thoroughly tested by users on this site and it's about as accurate as it needs to be considering the accuracy of domestic scales and CO2 regulators. Good luck on your journey.

Cheers,

Kal
 
Read the carbonation calculator thread and you'll discover as I did that beer doesn't behave the same as water so your equation will have an error margin of about 5% at SG 1.015.

My calculator has been thoroughly tested by users on this site and it's about as accurate as it needs to be considering the accuracy of domestic scales and CO2 regulators. Good luck on your journey.

Cheers,

Kal

an error of 5% is acceptable. Dialing in my pressure gauge to 10 or 10.5 or 20 or 21PSI is beyond the accuracy of my gauge.
 
While working on incorporating this functionality into RPints, I discovered an error in one of the cells that calculates the weight of dissolved CO2 (so only slightly impacts it which is why I never noticed it before). I've fixed it now and uploaded a new version. Apologies for any inaccuracy caused.

Cheers,

Kal
I just thought, if you follow the link in this previous post and download the files, the formulas you want will be in the tap_form.php file (the ugly jQuery at the bottom of the file). I've put comments next to each of them so you should be able to get what you need from there.

Good luck on your quest!

Cheers,

Kal
 
Hi all,

This is my second thread as thanks to the assistance of the amazing ajdelange in my first thread I was finally able to add the finishing touches to my long neglected Keg Volume Calculator (be advised that the Carbonation Calculator in my first thread is still very much a work in progress but for all intents and purposes here it is accurate enough).

If you just want the spreadsheet rather than reading on you can download my Keg Volume Calculator here.

Hey Kal,

Has your link to the Keg Volume Calculator changed or moved? I got a Google error when trying to access. Let me know. Thanks!
 
Last edited:
[copied from my post on another thread]

We haven't heard from @kaljade since this past March, unfortunately, so no way to track down where he stashed the distributable copy.

That said, I have a prior version that has been working quite nicely, but it's not the same MD5 version as what is listed in the thread I linked.
My version was generated in Jan 9, 2019, which if you review the thread above you'll see where it likely fits with the changes. For sure, no major errors are extant - I use this all the time I with my sf800 meters rarely have more than a half pour error when a keg kicks (or should have). Lately it's really been within 3 to 4 ounces.

As Kal set me up with his program at the very beginning I don't think he'd be upset if I parked a copy of what I have on my Google Drive.

Let me know if the link doesn't work. Since Windows 10 and Google Drive have been mucking about there's a decent chance I bodged the link :)

https://drive.google.com/file/d/1bdULrHg0cYUK0Z0v64iQap8esF7XULTv/view?usp=sharing

Cheers!
 
Hi all,

This is my second thread as thanks to the assistance of the amazing ajdelange in my first thread I was finally able to add the finishing touches to my long neglected Keg Volume Calculator (be advised that the Carbonation Calculator in my first thread is still very much a work in progress but for all intents and purposes here it is accurate enough).

If you just want the spreadsheet rather than reading on you can download my Keg Volume Calculator here.

Otherwise, once again, thanks for stopping by!

So my journey began here on HomeBrewTalk.com in the RaspberryPints - Digital Taplist Solution thread (which I invite everyone who hasn't already seen it to take a look), which now that I have set up is absolutely fabulous for tracking keg volume under normal circumstances (if you start with a completely full keg and you have no phantom pours, premature kicks, etc), but what happens when circumstances go outside of the norm? Well you can join the rest of the planet that do not have flow meters on their kegs, or you can use the new and improved Keg Volume Calculator.

So the base formula comes from a post in the RaspberryPints thread by DrunkleJon:



So armed with that I just expanded it to include a VLOOKUP table to allow for water density changes according to temperature, so all you needed to do was weigh your keg (before and after), enter in the temperature and final gravity and it would do the rest. The only caveat was of course that it was based on the pressure being a standard atmosphere (pretty big caveat if you've read my first thread).

Enter version two: "to allow for pressure/altitude (not that it makes a huge difference on the volumes we are using, but for the sake of accuracy, scalability and to satisfy my inner pedant), and also to select between metric and imperial units.", so now we were getting closer with the exception of Henry's Law of course:



So the final piece in the puzzle was being able to allow for the weight of the dissolved CO2, which began an entirely new journey of incorrect assumptions, followed by the patient guidance of ajdelange (further details in the other thread so I won't bore you all with the details again), which brings me here.

So in a nutshell here's how it works:
  • Calculate the weight of the beer less the keg
  • Calculate the volume of pure water at the same weight and temperature
  • Adjust based on absolute pressure: gauge pressure (at equilibrium) plus barometric pressure
  • Adjust the volume based on the gravity of the beer
  • Calculate the weight of CO2 dissolved in the beer
  • Adjust the volume based on the weight of the dissolved CO2
Simple enough, so how do I use it?
  1. Enter your measurements in column B
  2. Select you units of measurement from the dropdowns in column C (see screenshot)
  3. Note: Gauge pressure is only required if it is already force carbonated, if it's a new keg ensure row 6 is set to 0 psi/kPa
2017-08-09_1022-68301.png


So, good people, please road test it for me and let me know if it is of value or not, and any suggestions/corrections/criticisms are always welcome.

More information on the above can be located at the following links:

Better Carbonation Calculator (hopefully) thread

[Version 2 Release] RaspberryPints - Digital Taplist Solution thread

Mass, Weight, Density or Specific Gravity of Water at Various Temperatures

http://www.wetnewf.org/pdfs/Brewing_articles/CO2 Volumes.pdf

Keg Volume Calculator
Hey, I know this is 7 years ago, but the keg volume calculator link doesn't seem to be working anymore. I would love access to this spreadsheet if it was still out there somewhere! Cheers for your work on this!
 
Back
Top