Offline temperature correction calculator
Moderator: Site Moderator
-
- Swill Maker
- Posts: 315
- Joined: Fri Sep 20, 2013 3:00 pm
Offline temperature correction calculator
Hi, I want an offline alcometer temperature correction tool for my excel spread sheet.
Something like this is what I’m after but the actual formula used isn’t referenced.
I’m not expecting it to be given up freely (although that would be great).
If I try to tackle it myself then what would be the best way to approach the problem?
A look-up table might be a bit of a PITA and not sure how it would deal non whole numbers properly.
A formula is what I would really like. Input measured ABV and Temp in C° and out pops actual ABV.
I guess this data is a good starting point but if there’s something better around feel free to put up a link.
When I searched the forums I found plenty of examples like here of the same question being asked a number of times before.
It would be good to finally put up an answer.
Something like this is what I’m after but the actual formula used isn’t referenced.
I’m not expecting it to be given up freely (although that would be great).
If I try to tackle it myself then what would be the best way to approach the problem?
A look-up table might be a bit of a PITA and not sure how it would deal non whole numbers properly.
A formula is what I would really like. Input measured ABV and Temp in C° and out pops actual ABV.
I guess this data is a good starting point but if there’s something better around feel free to put up a link.
When I searched the forums I found plenty of examples like here of the same question being asked a number of times before.
It would be good to finally put up an answer.
- Tokoroa_Shiner
- Distiller
- Posts: 1321
- Joined: Mon Jan 06, 2014 3:02 am
Re: Offline temperature correction calculator
If you have and iPhone there are some apps that have temp correction and are pretty good. Not too sure about other phones or computers though.
Must read topics for new members
The Rules By Which We Live By
Safety And Related Issues
New Distillers Reading Lounge
Have Fun, Keep Safe and Shine On
The Rules By Which We Live By
Safety And Related Issues
New Distillers Reading Lounge
Have Fun, Keep Safe and Shine On
Re: Offline temperature correction calculator
-1.5% for every ten degrees F over 60F. Now you're more accurate than most hydrometers!
CCVM http://homedistiller.org/forum/viewtopi ... d#p7104768" onclick="window.open(this.href);return false;" rel="nofollow
Ethyl Carbamate Docs viewtopic.php?f=6&t=55219&p=7309262&hil ... e#p7309262
DSP-AR-20005
Ethyl Carbamate Docs viewtopic.php?f=6&t=55219&p=7309262&hil ... e#p7309262
DSP-AR-20005
-
- Swill Maker
- Posts: 315
- Joined: Fri Sep 20, 2013 3:00 pm
Re: Offline temperature correction calculator
I work in C and I don't think it's quite as simple as that.
I need something that works across the the entire range from 0% to +95% and at least ±10°C
I need something that works across the the entire range from 0% to +95% and at least ±10°C
Re: Offline temperature correction calculator
Hi JB,
In Edwin's paper On the Conversion of Alcohol, , he cites his source as Organisation Internationale de Métrologie Légale: Recommendation No 22: Alcoholmetry “ International alcoholometric tables” which you can find here: http://zd2.chem.uni.wroc.pl/pliki/alcohm.pdf" onclick="window.open(this.href);return false;" rel="nofollow . On page 12 is the formula for the density, in kg/m3, derived from ABW and temperature. This can be converted to specific gravity by dividing by 1000.
The paper is a scan, so using optical character recognition, I turned the coefficients on page 13 into numbers and plugged them into the formula. Then, using Mathematica, I turned the formula in C code.
Here are the coefficients and the formula in Mathematica format. The [[k]] notation means to select the kth coefficient from the list. Here is the function for finding the specific gravity of a mixture of ethanol and water, where p is the ABW (range 0.0 to 1.0) and t is the temperature in degrees Celcius:
double SG(double p,double t); /* might need long double. The paper insists on keeping full 16 digit precision */
double SG(double p,double t) /* p is ABW range 0.0 to 1.0, t is temperature in degrees C */
{
double density;
density= 999.8369332492159 +
t*(0.0680179946752 +
t*(-0.009183962302400001 +
t*(0.00011193186756 +
t*(-1.7049478059999997e-6 +
(1.913806172e-8 - 9.9739231e-11*t)*t))))+
p*(-194.95221320903258 +
t*(-0.32252658830280767 +
t*(0.040899207855771516 +
t*(-0.0011178526815914388 +
(6.863451030404436e-6 -
2.788074354782409e-8*t)*t))) +
p*(547.610657635972 +
t*(2.2744902911294567 +
t*(-0.8964705416765777 +
t*(0.019523247104114065 +
(-0.000010108671456964464 +
1.345612883493354e-8*t)*t))) +
p*(-2372.513041119161 +
t*(-81.72933593467695 +
t*(9.860431257132182 +
(-0.20077738388222355 +
6.515031360099367e-6*t)*t)) +
p*(24845.064214590027 +
t*(-18.32173578664333 +
t*(-47.85286599833167 +
(1.0231142295061788 -
1.51578483698721e-6*t)*t)) +
p*(-163728.97564365985 +
t*(2461.250152769485 +
(123.44190144874815 -
2.895696483903638*t)*t) +
p*(553694.0780024468 +
t*(-10714.996555836937 +
t*(-178.96806840028353 +
4.810060584300675*t)) +
p*(-1.0831004118106463e6 +
t* (22570.90436073888 +
(138.0534518055655 -
4.672147440794683*t)*t) +
p*(1.2916829891046542e6 +
t*(-27427.721866222408 +
t*(-39.43899206858465 +
2.458043105903461*t)) +
p*(-931648.5506640136 +
t*(19640.053200849212 +
(-11.67416663955305 -
0.5411227621436812*t)*t) +
p*(374827.25068067823 +
t*(-7717.920294637688 +
7.4429715301887835*t) +
p*(-64745.21109997948 +
1285.6178419989742*t)))))))))));
return density/1000.0;
}
Knowing the ABW and the SG, enjoy yourself finding the %ABV!
Temperature is over the range -20 to +40 degrees C. Accurate to five significant figures. How does Edwin find these things?
M
In Edwin's paper On the Conversion of Alcohol, , he cites his source as Organisation Internationale de Métrologie Légale: Recommendation No 22: Alcoholmetry “ International alcoholometric tables” which you can find here: http://zd2.chem.uni.wroc.pl/pliki/alcohm.pdf" onclick="window.open(this.href);return false;" rel="nofollow . On page 12 is the formula for the density, in kg/m3, derived from ABW and temperature. This can be converted to specific gravity by dividing by 1000.
The paper is a scan, so using optical character recognition, I turned the coefficients on page 13 into numbers and plugged them into the formula. Then, using Mathematica, I turned the formula in C code.
Here are the coefficients and the formula in Mathematica format. The [[k]] notation means to select the kth coefficient from the list. Here is the function for finding the specific gravity of a mixture of ethanol and water, where p is the ABW (range 0.0 to 1.0) and t is the temperature in degrees Celcius:
double SG(double p,double t); /* might need long double. The paper insists on keeping full 16 digit precision */
double SG(double p,double t) /* p is ABW range 0.0 to 1.0, t is temperature in degrees C */
{
double density;
density= 999.8369332492159 +
t*(0.0680179946752 +
t*(-0.009183962302400001 +
t*(0.00011193186756 +
t*(-1.7049478059999997e-6 +
(1.913806172e-8 - 9.9739231e-11*t)*t))))+
p*(-194.95221320903258 +
t*(-0.32252658830280767 +
t*(0.040899207855771516 +
t*(-0.0011178526815914388 +
(6.863451030404436e-6 -
2.788074354782409e-8*t)*t))) +
p*(547.610657635972 +
t*(2.2744902911294567 +
t*(-0.8964705416765777 +
t*(0.019523247104114065 +
(-0.000010108671456964464 +
1.345612883493354e-8*t)*t))) +
p*(-2372.513041119161 +
t*(-81.72933593467695 +
t*(9.860431257132182 +
(-0.20077738388222355 +
6.515031360099367e-6*t)*t)) +
p*(24845.064214590027 +
t*(-18.32173578664333 +
t*(-47.85286599833167 +
(1.0231142295061788 -
1.51578483698721e-6*t)*t)) +
p*(-163728.97564365985 +
t*(2461.250152769485 +
(123.44190144874815 -
2.895696483903638*t)*t) +
p*(553694.0780024468 +
t*(-10714.996555836937 +
t*(-178.96806840028353 +
4.810060584300675*t)) +
p*(-1.0831004118106463e6 +
t* (22570.90436073888 +
(138.0534518055655 -
4.672147440794683*t)*t) +
p*(1.2916829891046542e6 +
t*(-27427.721866222408 +
t*(-39.43899206858465 +
2.458043105903461*t)) +
p*(-931648.5506640136 +
t*(19640.053200849212 +
(-11.67416663955305 -
0.5411227621436812*t)*t) +
p*(374827.25068067823 +
t*(-7717.920294637688 +
7.4429715301887835*t) +
p*(-64745.21109997948 +
1285.6178419989742*t)))))))))));
return density/1000.0;
}
Knowing the ABW and the SG, enjoy yourself finding the %ABV!
Temperature is over the range -20 to +40 degrees C. Accurate to five significant figures. How does Edwin find these things?
M
-
- Swill Maker
- Posts: 315
- Joined: Fri Sep 20, 2013 3:00 pm
Re: Offline temperature correction calculator
HI JB,
Here's what I've come up with, using Mathematica. You could do this in C, but you'd have to write a function that can find the ABW when you know the SG in the monster function above. That's not too difficult using successive approximation. In Mathematica, the FindRoot[] function does the job.
These are the functions I've come up with. The implementations are not too important, although you can use them to create C functions.
ABWtoSGatT[ABW_, t_] := density[ABW, t]/1000.0
SGtoABWatT[SG_, t_] := FindRoot[SG == ABWtoSGatT[ABW, t], { ABW, 0.5}][[1, 2]]
ABWtoABVatT[ABW_, t_] := (density[ABW, t]/density[1.0, t]) * ABW
ABVtoABWatT[ABV_, t_] := FindRoot[ABV == ABWtoABVatT[ABW, t], {ABW, 0.5}][[1, 2]]
ABVtoSGatT[ABV_, t_] := ABWtoSGatT[ABVtoABWatT[ABV, t], t]
SGtoABVatT[sg_, t_] := ABWtoABVatT[SGtoABWatT[sg, t], t]
Here is what you said, "A formula is what I would really like. Input measured ABV and Temp in C\[Degree] and out pops actual ABV."
The alcoholmeter actually reads the SG, regardless of temperature.
Say the temperature is 30 degrees, and the alcoholmeter reads 70%ABV.
What it is really reading is the SG calibrated at 20 degrees.
ABVtoSGatT[.7, 20] = 0.885562
So the SG is 0.88556.
The real ABV is then
SGtoABVatT[.88556, 30] = 0.666835
Or 66.7%ABV
DAD says, "-1.5% for every ten degrees F over 60F"
30 degrees C = 86 degrees F
(86 - 60)/10 = 2.6
2.6 * 1.5 = 3.9 % off the 70%ABV value read
70 - 3.9 = 66.1%ABV according to DAD. So we are close, or rather, he is close!
The final formula is:
ABVatT = SGtoABVatT[ABVtoSGatT[measuredABV, 20], T]
Edwin, if you are out there, do my functions make sense to you?
M
Here's what I've come up with, using Mathematica. You could do this in C, but you'd have to write a function that can find the ABW when you know the SG in the monster function above. That's not too difficult using successive approximation. In Mathematica, the FindRoot[] function does the job.
These are the functions I've come up with. The implementations are not too important, although you can use them to create C functions.
ABWtoSGatT[ABW_, t_] := density[ABW, t]/1000.0
SGtoABWatT[SG_, t_] := FindRoot[SG == ABWtoSGatT[ABW, t], { ABW, 0.5}][[1, 2]]
ABWtoABVatT[ABW_, t_] := (density[ABW, t]/density[1.0, t]) * ABW
ABVtoABWatT[ABV_, t_] := FindRoot[ABV == ABWtoABVatT[ABW, t], {ABW, 0.5}][[1, 2]]
ABVtoSGatT[ABV_, t_] := ABWtoSGatT[ABVtoABWatT[ABV, t], t]
SGtoABVatT[sg_, t_] := ABWtoABVatT[SGtoABWatT[sg, t], t]
Here is what you said, "A formula is what I would really like. Input measured ABV and Temp in C\[Degree] and out pops actual ABV."
The alcoholmeter actually reads the SG, regardless of temperature.
Say the temperature is 30 degrees, and the alcoholmeter reads 70%ABV.
What it is really reading is the SG calibrated at 20 degrees.
ABVtoSGatT[.7, 20] = 0.885562
So the SG is 0.88556.
The real ABV is then
SGtoABVatT[.88556, 30] = 0.666835
Or 66.7%ABV
DAD says, "-1.5% for every ten degrees F over 60F"
30 degrees C = 86 degrees F
(86 - 60)/10 = 2.6
2.6 * 1.5 = 3.9 % off the 70%ABV value read
70 - 3.9 = 66.1%ABV according to DAD. So we are close, or rather, he is close!
The final formula is:
ABVatT = SGtoABVatT[ABVtoSGatT[measuredABV, 20], T]
Edwin, if you are out there, do my functions make sense to you?
M
-
- Swill Maker
- Posts: 315
- Joined: Fri Sep 20, 2013 3:00 pm
Re: Offline temperature correction calculator
Thanks M.
So I need to go from ABV measured to ABW to SG @ T measured. Then find what the SG will go to @ T 20° and back again to ABV the same way I got in?
It looks like a solution which is fantastic but that’s a lot of farting around on excel and I couldn’t even read your density equation let alone play with it.
0.6% off at 30° for Dads method is probably accurate enough for me and my purposes at this stage.
So modifying dads tip –
(measured%-actual%) / ΔT gives 0.33% per °C
This means @ 30°, 70% measured - (0.33%*10°) = 66.7%
So looking at the data set in the OP, how does -0.33%*ΔT perform at other temps and ABVs?
30%@30°C off the chart is 26% actual vs calculated 26.7%,
so 0.7% off.
30.6%@10°C off the chart is 35% actual vs calculated 33.9%,
so -1.1% off.
50%@30°C off the chart is 46% actual vs calculated 46.7%,
so 0.7% off.
50.1%@10°C off the chart is 55% actual vs calculated 53.4%,
so -1.6% off.
70.4%@30°C off the chart is 67% actual vs calculated 67.1%,
so 0.1% off.
70.7%@10°C off the chart is 74% actual vs calculated 74%,
so spot on.
80.4%@30°C off the chart is 77% actual vs calculated 77.1%,
so 0.1% off.
80.7%@10°C off the chart is 84% actual vs calculated 84%,
so spot on.
97.1%@30°C off the chart is 95% actual vs calculated 93.8%,
so -1.2% off.
92.9%@10°C off the chart is 95% actual vs calculated 96.2%,
so 1.2% off.
I think I got that right. Seems to be most accurate in the 70% to 80% range (where I did the original calc) which is where I work mostly and my temp differences are usually half that unless I’ve just diluted.
Thanks for the input guys. I think I may take the easy road on this one.
Any further thoughts?
So I need to go from ABV measured to ABW to SG @ T measured. Then find what the SG will go to @ T 20° and back again to ABV the same way I got in?
It looks like a solution which is fantastic but that’s a lot of farting around on excel and I couldn’t even read your density equation let alone play with it.
0.6% off at 30° for Dads method is probably accurate enough for me and my purposes at this stage.
So modifying dads tip –
(measured%-actual%) / ΔT gives 0.33% per °C
This means @ 30°, 70% measured - (0.33%*10°) = 66.7%
So looking at the data set in the OP, how does -0.33%*ΔT perform at other temps and ABVs?
30%@30°C off the chart is 26% actual vs calculated 26.7%,
so 0.7% off.
30.6%@10°C off the chart is 35% actual vs calculated 33.9%,
so -1.1% off.
50%@30°C off the chart is 46% actual vs calculated 46.7%,
so 0.7% off.
50.1%@10°C off the chart is 55% actual vs calculated 53.4%,
so -1.6% off.
70.4%@30°C off the chart is 67% actual vs calculated 67.1%,
so 0.1% off.
70.7%@10°C off the chart is 74% actual vs calculated 74%,
so spot on.
80.4%@30°C off the chart is 77% actual vs calculated 77.1%,
so 0.1% off.
80.7%@10°C off the chart is 84% actual vs calculated 84%,
so spot on.
97.1%@30°C off the chart is 95% actual vs calculated 93.8%,
so -1.2% off.
92.9%@10°C off the chart is 95% actual vs calculated 96.2%,
so 1.2% off.
I think I got that right. Seems to be most accurate in the 70% to 80% range (where I did the original calc) which is where I work mostly and my temp differences are usually half that unless I’ve just diluted.
Thanks for the input guys. I think I may take the easy road on this one.
Any further thoughts?
-
- Swill Maker
- Posts: 315
- Joined: Fri Sep 20, 2013 3:00 pm
Re: Offline temperature correction calculator
P.S. When I said I work in C in was referring to Celsius not the programing language.
I don't know how that was interpreted but I don't code bro.
I don't know how that was interpreted but I don't code bro.
Re: Offline temperature correction calculator
Hi JB,
Here is the equation and an explanation of its derivation:
M
Here is the equation and an explanation of its derivation:
M
-
- Swill Maker
- Posts: 315
- Joined: Fri Sep 20, 2013 3:00 pm
Re: Offline temperature correction calculator
Hi M, I just tried to bang it in to excel but it wasn't looking quite right.
I thought maybe I wasn't interpreting it correctly then I released my percents in excel are actually 0 to 1 not 0 to 100.
After I sorted all that out it seems to be working very well. Thanks heaps
Here's the excel spreadsheet if anyone interested.
It has the proper dilution calculator and a run-sheet with some pretty tricky formatting and calculator bits and pieces.
I thought maybe I wasn't interpreting it correctly then I released my percents in excel are actually 0 to 1 not 0 to 100.
After I sorted all that out it seems to be working very well. Thanks heaps
Here's the excel spreadsheet if anyone interested.
It has the proper dilution calculator and a run-sheet with some pretty tricky formatting and calculator bits and pieces.