www/js/global.js

changeset 538
41d21817608e
parent 529
bb8a37fe6326
child 539
fe9ac6d49c4f
equal deleted inserted replaced
531:7c37a6f85d55 538:41d21817608e
870 870
871 871
872 /* 872 /*
873 * Berekeningen uit https://www.hobbybrouwen.nl/forum/index.php/topic,6079.msg69464.html#msg69464 873 * Berekeningen uit https://www.hobbybrouwen.nl/forum/index.php/topic,6079.msg69464.html#msg69464
874 */ 874 */
875 function toIBU(Use, Form, SG, Volume, Amount, Boiltime, Alpha, Method) { 875 function toIBU(Use, Form, SG, Volume, Amount, Boiltime, Alpha, Method, Whirlpool9, Whirlpool7, Whirlpool6) {
876 876
877 var gravity, liters, alpha, mass, time, fmoment = 1.0, pfactor = 1.0, ibu = 0, boilfactor, sgfactor, 877 var gravity, liters, alpha, mass, time, fmoment = 1.0, pfactor = 1.0, ibu = 0, boilfactor, sgfactor,
878 AddedAlphaAcids, Bigness_factor, BoilTime_factor, utiisation; 878 AddedAlphaAcids, Bigness_factor, BoilTime_factor, utiisation;
879 879
880 gravity = parseFloat(SG); 880 gravity = parseFloat(SG);
899 pfactor += my_factor_wethop / 100; // From https://github.com/chrisgilmerproj/brewday/blob/master/brew/constants.py 899 pfactor += my_factor_wethop / 100; // From https://github.com/chrisgilmerproj/brewday/blob/master/brew/constants.py
900 } else if (Form == 4) { // Cryo hop 900 } else if (Form == 4) { // Cryo hop
901 pfactor += my_factor_cryohop / 100; 901 pfactor += my_factor_cryohop / 100;
902 } 902 }
903 903
904 // Ideas from Zymurgy March-April 2018. These are not exact formulas!
905 whirlibus = 0;
906 if (Use == 4) { // Any whirlpool
907 if (Whirlpool9) {
908 // 20 mg/l/50 min
909 whirlibus += (alpha * mass * 20) / liters * (Whirlpool9 / 50);
910 console.log('Whirlpool9:' + alpha * mass * 20 + ' liter:' + liters + ' time:' + Whirlpool9 + ' ibu' + (alpha * mass * 20) / liters * (Whirlpool9 / 50));
911 }
912 if (Whirlpool7) {
913 // 6 mg/l/50 min
914 whirlibus += (alpha * mass * 6) / liters * (Whirlpool7 / 50);
915 console.log('Whirlpool7:' + alpha * mass * 6 + ' liter:' + liters + ' time:' + Whirlpool7 + ' ibu' + (alpha * mass * 6) / liters * (Whirlpool7 / 50));
916 }
917 if (Whirlpool6) {
918 // 2 mg/l/50 min
919 whirlibus += (alpha * mass * 2) / liters * (Whirlpool6 / 50);
920 console.log('Whirlpool6:' + alpha * mass * 2 + ' liter:' + liters + ' time:' + Whirlpool6 + ' ibu' + (alpha * mass * 2) / liters * (Whirlpool6 / 50));
921 }
922 }
923
904 if (Method == 0) { // Tinseth 924 if (Method == 0) { // Tinseth
905 /* http://realbeer.com/hops/research.html */ 925 /* http://realbeer.com/hops/research.html */
906 AddedAlphaAcids = (alpha * mass * 1000) / liters; 926 AddedAlphaAcids = (alpha * mass * 1000) / liters;
907 Bigness_factor = 1.65 * Math.pow(0.000125, gravity - 1); 927 Bigness_factor = 1.65 * Math.pow(0.000125, gravity - 1);
908 BoilTime_factor = ((1 - Math.exp(-0.04 * time)) / 4.15); 928 BoilTime_factor = ((1 - Math.exp(-0.04 * time)) / 4.15);
909 utiisation = Bigness_factor * BoilTime_factor; 929 utiisation = Bigness_factor * BoilTime_factor;
910 ibu = Round(utiisation * AddedAlphaAcids * fmoment * pfactor, 1); 930 ibu = Round(utiisation * AddedAlphaAcids * fmoment * pfactor + whirlibus, 1);
911 } 931 }
912 if (Method == 2) { // Daniels 932 if (Method == 2) { // Daniels
913 if (Form == 2) // Leaf 933 if (Form == 2) // Leaf
914 boilfactor = -(0.0041 * time * time) + (0.6162 * time) + 1.5779; 934 boilfactor = -(0.0041 * time * time) + (0.6162 * time) + 1.5779;
915 else 935 else
916 boilfactor = -(0.0051 * time * time) + (0.7835 * time) + 1.9348; 936 boilfactor = -(0.0051 * time * time) + (0.7835 * time) + 1.9348;
917 if (gravity < 1050) 937 if (gravity < 1050)
918 sgfactor = 0; 938 sgfactor = 0;
919 else 939 else
920 sgfactor = (gravity - 1050) / 200; 940 sgfactor = (gravity - 1050) / 200;
921 ibu = Round(fmoment * ((mass * (alpha * 100) * boilfactor * 0.1) / (liters * (1 + sgfactor))), 1); 941 ibu = Round(fmoment * ((mass * (alpha * 100) * boilfactor * 0.1) / (liters * (1 + sgfactor))) + whirlibus, 1);
922 } 942 }
923 if (Method == 1) { // Rager 943 if (Method == 1) { // Rager
924 boilfactor = fmoment * 18.11 + 13.86 * Math.tanh((time * 31.32) / 18.27); 944 boilfactor = fmoment * 18.11 + 13.86 * Math.tanh((time * 31.32) / 18.27);
925 if (gravity < 1050) 945 if (gravity < 1050)
926 sgfactor = 0; 946 sgfactor = 0;
927 else 947 else
928 sgfactor = (gravity - 1050) / 200; 948 sgfactor = (gravity - 1050) / 200;
929 ibu = Round((mass * (alpha * 100) * boilfactor * 0.1) / (liters * (1 + sgfactor)), 1); 949 ibu = Round((mass * (alpha * 100) * boilfactor * 0.1) / (liters * (1 + sgfactor)) + whirlibus, 1);
930 } 950 }
931 951
932 //console.log("toIBU("+Use+","+Form+","+SG+","+Volume+","+Amount+","+Boiltime+","+Alpha+","+Method+"):"+ibu+" fm:"+fmoment+" pf:"+pfactor); 952 // console.log('toIBU(' + Use + ',' + Form + ',' + SG + ',' + Volume + ',' + Amount + ',' + Boiltime + ',' +
953 // Alpha + ',' + Method + ',' + Whirlpool9 + ',' + Whirlpool7 + ',' + Whirlpool6 + '):' + ibu + ' fm:' + fmoment + ' pf:' + pfactor);
933 return ibu; 954 return ibu;
934 } 955 }
935 956
936 957
937 958

mercurial