www/js/global.js

changeset 561
dc618b8a9552
parent 554
c62ff53cfc3d
child 577
b4bfed3684d0
equal deleted inserted replaced
560:850e82c1021d 561:dc618b8a9552
1071 return sg_to_plato(sg) * my_brix_correction; 1071 return sg_to_plato(sg) * my_brix_correction;
1072 } 1072 }
1073 1073
1074 1074
1075 1075
1076 function brix_to_fg(OBrix, FBrix) {
1077 // Brouwhulp, werkt zonder brix_correctie, waarom?
1078 var FGbh = Round(1.0031 - 0.002318474 * OBrix - 0.000007775 * (OBrix * OBrix) - 0.000000034 * Math.pow(OBrix, 3) +
1079 0.00574 * (FBrix) + 0.00003344 * (FBrix * FBrix) + 0.000000086 * Math.pow(FBrix, 3), 4);
1080
1081 // from http://seanterrill.com FGoc = old cubix, FGnc = new cubic, FGnl = new linear
1082 var OBc = OBrix / my_brix_correction;
1083 var FBc = FBrix / my_brix_correction;
1084
1085 // Old Cubic, almost the same a BrouwHulp, different offset and with brix_correction.
1086 var FGoc = Round(1.001843 - 0.002318474 * OBc - 0.000007775 * (OBc * OBc) - 0.000000034 * Math.pow(OBc, 3) +
1087 0.00574 * (FBc) + 0.00003344 * (FBc * FBc) + 0.000000086 * Math.pow(FBc, 3), 4);
1088
1089 // New cubic. This looks the best to use.
1090 var FGnc = Round(1 - 0.0044993 * (OBc) + 0.0117741 * (FBc) +
1091 0.000275806 * (OBc * OBc) - 0.00127169 * (FBc * FBc) -
1092 0.00000727999 * Math.pow(OBc, 3) + 0.0000632929 * Math.pow(FBc, 3), 4);
1093
1094 // New linear, results are pretty much too high and way off for heavy beers.
1095 var FGnl = Round(1 - 0.000856829 * OBc + 0.00349412 * FBc, 4);
1096
1097 console.log('brix_to_fg(' + Round(OBrix, 2) + ', ' + FBrix + ') FGbh:' + FGbh + ' FGoc:' + FGoc + ' FGnc:' + FGnc + ' FGnl:' + FGnl);
1098 return FGnc;
1099 }
1100
1101
1102
1076 function estimate_sg(sugars, batch_size) { 1103 function estimate_sg(sugars, batch_size) {
1077 1104
1078 var plato, sg, i; 1105 var plato, sg, i;
1079 1106
1080 plato = 100 * sugars / batch_size; 1107 plato = 100 * sugars / batch_size;

mercurial