diff -r 850e82c1021d -r dc618b8a9552 www/js/global.js --- a/www/js/global.js Wed Dec 04 21:52:37 2019 +0100 +++ b/www/js/global.js Thu Dec 05 13:21:41 2019 +0100 @@ -1073,6 +1073,33 @@ +function brix_to_fg(OBrix, FBrix) { + // Brouwhulp, werkt zonder brix_correctie, waarom? + var FGbh = Round(1.0031 - 0.002318474 * OBrix - 0.000007775 * (OBrix * OBrix) - 0.000000034 * Math.pow(OBrix, 3) + + 0.00574 * (FBrix) + 0.00003344 * (FBrix * FBrix) + 0.000000086 * Math.pow(FBrix, 3), 4); + + // from http://seanterrill.com FGoc = old cubix, FGnc = new cubic, FGnl = new linear + var OBc = OBrix / my_brix_correction; + var FBc = FBrix / my_brix_correction; + + // Old Cubic, almost the same a BrouwHulp, different offset and with brix_correction. + var FGoc = Round(1.001843 - 0.002318474 * OBc - 0.000007775 * (OBc * OBc) - 0.000000034 * Math.pow(OBc, 3) + + 0.00574 * (FBc) + 0.00003344 * (FBc * FBc) + 0.000000086 * Math.pow(FBc, 3), 4); + + // New cubic. This looks the best to use. + var FGnc = Round(1 - 0.0044993 * (OBc) + 0.0117741 * (FBc) + + 0.000275806 * (OBc * OBc) - 0.00127169 * (FBc * FBc) - + 0.00000727999 * Math.pow(OBc, 3) + 0.0000632929 * Math.pow(FBc, 3), 4); + + // New linear, results are pretty much too high and way off for heavy beers. + var FGnl = Round(1 - 0.000856829 * OBc + 0.00349412 * FBc, 4); + + console.log('brix_to_fg(' + Round(OBrix, 2) + ', ' + FBrix + ') FGbh:' + FGbh + ' FGoc:' + FGoc + ' FGnc:' + FGnc + ' FGnl:' + FGnl); + return FGnc; +} + + + function estimate_sg(sugars, batch_size) { var plato, sg, i;