I've seen calorie counts offered in a few other calculators. This is usually per 12oz but it should be easy to offer size customization once the base calorie calculation is implemented.
The details of how I would approach the formula is below. All that is needed is the ABV, the volume of liquid, and the FG. This is not an exact science because density is dependent on temperature, but it should get you pretty darn close!
There's a formula here which works similarly and is a ton simpler, and gives lower values in general:
http://www.primetab.com/formulas.html
I've created a spreadsheet to compare the two if you're interested. You can download a copy (originally created in ods).
https://docs.google.com/spreadsheet/ccc ... adGc#gid=0
I would note that if you take the Sc constant below and tweak it to 0.05 / 0.026, our two formulas start to come much closer. This is reasonable, as we can assume there is more other stuff making up the FG than pure carbs and that some of this other stuff is not digestible. I had fun deriving the equations below though!
Suppose you have 12fl oz (355ml) of 5% beer at a FG of 1.008. Here's how you could estimate the total calories as a series of simple equations. An in-depth discussion follows.
V = 355ml
ABV = 0.05
FG = 1.008 g/ml
Note: raw numbers below are reference values
Av (alc volume) = ABV * V
Am (alc mass) = Av * 0.79 g/ml
Ac (alc cals) = Am * 6.9 cal/g
Ac (simplified) = 5.451 * ABV * V
Nv (non-alc volume) = V - Av
Tm (total mass) = V * FG
Nm (non-alc mass) = Tm - Am
Nd (non-alc density) = Nm / Nv
Sc (sugar concentration ratio) = 0.05 / 0.018
Ns (non-alc sugar by mass) = Sc * (Nd - 1)
Nc (non-alc cals) = Ns * Nm * 4 cal/gram
Nc (simplified) =
Calories = Nc + Ac
Calculating the calories from alcohol
5% ABV means 355ml * 0.05 or 17.75ml alcohol
Alcohol's density is 0.79 g/ml, so we have 17.75ml * 0.79 g/ml = 14.02g alcohol
Alcohol has 6.9 calories/gram, so we have 6.9 cal/g * 14.02g ~= 97 calories from alcohol.
Estimating the other calories
We need to figure out the gravity of the liquid were the alcohol not in it.
1.008 gravity of 355ml of liquid means that the liquid is 0.8% heavier than water.
Since 355ml water = 355g, 355g * 1.008 = 357.84g for the total weight of the liquid
If the alcohol were magically removed, we would have 355ml - 17.75ml = 337.25ml of liquid that weighs 357.84g - 14.02g = 343.82g, giving a density of 1.019g/ml.
Now we have a problem because depending on what's dissolved in the liquid, we will have different calibration curves of concentration versus density. This sucks because there's no real way to determine this, but empirically treating it all like it was sugar seems to get us pretty close to real values.
So let's assume that everything is similar to sugar in this regard, giving very roughly 5% sugar by mass per 0.018 additional gravity points (
http://www.tiffin.k12.oh.us/userfiles/9 ... ontent.pdf). x / 0.019 = .05 / 0.018, x / 0.019 = 2.78, or x = 5.28%, meaning that if all the 1.019 gravity points in our non-alcohol solution in fact came from pure sugar, we would have very approximately 343.82g * 0.0528 = 18.15g of sugar at 4cal/gram giving 72 non-alcohol calories.
The total calories is then simply 97 + 72 = 169 calories. This matches pretty well with http://www.simplybeer.com/2009/08/19/ho ... n-my-beer/ considering a FG of 1.008 is on the low end. If I repeat the calculations with a FG of 1.018, I get:
1.018 * 355g = 361.39g - 14.02g = 347.37g / 337.25ml = 1.030g/ml
2.78 * 0.030 = 8.3% sugar by weight, 30g = 120calories + 97 = 213 total calories
Certainly on the high end for a 5% beer, a bit past the high end of the linked chart, but when was the last time you saw a 5% beer at a real 1.018 FG that wasn't a stuck fermentation?
The details of how I would approach the formula is below. All that is needed is the ABV, the volume of liquid, and the FG. This is not an exact science because density is dependent on temperature, but it should get you pretty darn close!
There's a formula here which works similarly and is a ton simpler, and gives lower values in general:
http://www.primetab.com/formulas.html
I've created a spreadsheet to compare the two if you're interested. You can download a copy (originally created in ods).
https://docs.google.com/spreadsheet/ccc ... adGc#gid=0
I would note that if you take the Sc constant below and tweak it to 0.05 / 0.026, our two formulas start to come much closer. This is reasonable, as we can assume there is more other stuff making up the FG than pure carbs and that some of this other stuff is not digestible. I had fun deriving the equations below though!
Suppose you have 12fl oz (355ml) of 5% beer at a FG of 1.008. Here's how you could estimate the total calories as a series of simple equations. An in-depth discussion follows.
V = 355ml
ABV = 0.05
FG = 1.008 g/ml
Note: raw numbers below are reference values
Av (alc volume) = ABV * V
Am (alc mass) = Av * 0.79 g/ml
Ac (alc cals) = Am * 6.9 cal/g
Ac (simplified) = 5.451 * ABV * V
Nv (non-alc volume) = V - Av
Tm (total mass) = V * FG
Nm (non-alc mass) = Tm - Am
Nd (non-alc density) = Nm / Nv
Sc (sugar concentration ratio) = 0.05 / 0.018
Ns (non-alc sugar by mass) = Sc * (Nd - 1)
Nc (non-alc cals) = Ns * Nm * 4 cal/gram
Nc (simplified) =
Calories = Nc + Ac
Calculating the calories from alcohol
5% ABV means 355ml * 0.05 or 17.75ml alcohol
Alcohol's density is 0.79 g/ml, so we have 17.75ml * 0.79 g/ml = 14.02g alcohol
Alcohol has 6.9 calories/gram, so we have 6.9 cal/g * 14.02g ~= 97 calories from alcohol.
Estimating the other calories
We need to figure out the gravity of the liquid were the alcohol not in it.
1.008 gravity of 355ml of liquid means that the liquid is 0.8% heavier than water.
Since 355ml water = 355g, 355g * 1.008 = 357.84g for the total weight of the liquid
If the alcohol were magically removed, we would have 355ml - 17.75ml = 337.25ml of liquid that weighs 357.84g - 14.02g = 343.82g, giving a density of 1.019g/ml.
Now we have a problem because depending on what's dissolved in the liquid, we will have different calibration curves of concentration versus density. This sucks because there's no real way to determine this, but empirically treating it all like it was sugar seems to get us pretty close to real values.
So let's assume that everything is similar to sugar in this regard, giving very roughly 5% sugar by mass per 0.018 additional gravity points (
http://www.tiffin.k12.oh.us/userfiles/9 ... ontent.pdf). x / 0.019 = .05 / 0.018, x / 0.019 = 2.78, or x = 5.28%, meaning that if all the 1.019 gravity points in our non-alcohol solution in fact came from pure sugar, we would have very approximately 343.82g * 0.0528 = 18.15g of sugar at 4cal/gram giving 72 non-alcohol calories.
The total calories is then simply 97 + 72 = 169 calories. This matches pretty well with http://www.simplybeer.com/2009/08/19/ho ... n-my-beer/ considering a FG of 1.008 is on the low end. If I repeat the calculations with a FG of 1.018, I get:
1.018 * 355g = 361.39g - 14.02g = 347.37g / 337.25ml = 1.030g/ml
2.78 * 0.030 = 8.3% sugar by weight, 30g = 120calories + 97 = 213 total calories
Certainly on the high end for a 5% beer, a bit past the high end of the linked chart, but when was the last time you saw a 5% beer at a real 1.018 FG that wasn't a stuck fermentation?