Brewtarget / brewtarget

Main brewtarget source code repository.
GNU General Public License v3.0
312 stars 135 forks source link

More options on ABV calculation #613

Closed matty0ung closed 1 year ago

matty0ung commented 3 years ago

Alcohol Tool currently only offers one simple method of calculating ABV. There are more sophisticated (= presumably more accurate) algorithms, eg the official one used in the UK as described here: https://www.gov.uk/government/publications/excise-notice-226-beer-duty/excise-notice-226-beer-duty--2#calculation-strength

mattiasmaahl commented 3 years ago

Cool, do you think we should implement it in a way that lets the user decide what method to use? or do we implement the one that we figure is the best one?

matty0ung commented 3 years ago

Personally, I'd want to use whatever we think is the most accurate, rather than ask the user to choose from some list of algorithms that they likely know nothing about. (AIUI both the methods here https://www.brewersfriend.com/abv-calculator/ overstate alcohol content for beers with low-to-medium starting gravities.) I'm happy to be schooled in what "most accurate" means(!), but my starting assumption was the UK tax authorities would have some stake in accuracy because it affects how much alcohol duty they collect from professional brewers!

mattiasmaahl commented 3 years ago

You make a good point, then we just have to decide which is more accurate! Sorry, cannot help in that regard, but can do some research into the matter and inform of my findings. Lets discuss this futher. 😊

mattiasmaahl commented 3 years ago

After doing some research I found a bunch of "homebrew" variants of calculating the ABV, some actually kinda close to what you link to above.
I also found a paper detailing a 'few' calculation formulas and discussing the differenses and accuracy of them. https://onlinelibrary.wiley.com/doi/pdf/10.1002/j.2050-0416.2009.tb00387.x
That paper mentions your British legislated values as well, but it goes in to how to calculate the % Alcohol by weight (Aw/w) and discusses that in great detail, that on the other hand is too complicated I think. although they do provide formulas for converting between SG and RE they do not discuss converting between OG and OE.

I think we should look into the above British formula constants and see if we can find a way to automatically select the correct constant for calculating the ABV.

matty0ung commented 3 years ago

Good research! I think there's a relatively neat way to pull out the right constant for the UK formula.

mattiasmaahl commented 3 years ago

Sadly I won't be able to implement it for a few weeks as I'm going on vacation today. And that entails constant hard work all day every day finishing the painting of my house and building a patio, as those projects will take almost all of my time for the next few weeks I'm not gonna be able to code much I'm afraid. can have a look at it though when I get back to the office. (if you haven't already fixed it by then that is!)

I'll be keeping tabs on what's happening here though. merging small PRs or answering issues is still possible. 😄

matty0ung commented 3 years ago

Ha, sounds good. We'll have to swap notes as we are renovating our house too. At the moment, this involves digging up a concrete floor where the previous owner laid some drainpipes without too much regard to the law of gravity...

mattiasmaahl commented 3 years ago

Whoa!! that sounds bad! AND a lot like hard work too! Fixing other peoples mistakes IRL is the WORST. Fortunately my house was built last year so no previous owner issue! But still, the whole garden is a clay field mixed with some rather big rocks! 😂

matty0ung commented 1 year ago

I guess I forgot to close this ticket when I did the merge above.