www/js/global.js

changeset 538
41d21817608e
parent 529
bb8a37fe6326
child 539
fe9ac6d49c4f
--- a/www/js/global.js	Mon Oct 21 14:38:48 2019 +0200
+++ b/www/js/global.js	Sun Oct 27 20:20:09 2019 +0100
@@ -872,7 +872,7 @@
 /*
  * Berekeningen uit https://www.hobbybrouwen.nl/forum/index.php/topic,6079.msg69464.html#msg69464
  */
-function toIBU(Use, Form, SG, Volume, Amount, Boiltime, Alpha, Method) {
+function toIBU(Use, Form, SG, Volume, Amount, Boiltime, Alpha, Method, Whirlpool9, Whirlpool7, Whirlpool6) {
 
  var gravity, liters, alpha, mass, time, fmoment = 1.0, pfactor = 1.0, ibu = 0, boilfactor, sgfactor,
      AddedAlphaAcids, Bigness_factor, BoilTime_factor, utiisation;
@@ -901,13 +901,33 @@
   pfactor += my_factor_cryohop / 100;
  }
 
+ // Ideas from Zymurgy March-April 2018. These are not exact formulas!
+ whirlibus = 0;
+ if (Use == 4) { // Any whirlpool
+  if (Whirlpool9) {
+   // 20 mg/l/50 min
+   whirlibus += (alpha * mass * 20) / liters * (Whirlpool9 / 50);
+   console.log('Whirlpool9:' + alpha * mass * 20 + ' liter:' + liters + ' time:' + Whirlpool9 + ' ibu' + (alpha * mass * 20) / liters * (Whirlpool9 / 50));
+  }
+  if (Whirlpool7) {
+   // 6 mg/l/50 min
+   whirlibus += (alpha * mass * 6) / liters * (Whirlpool7 / 50);
+   console.log('Whirlpool7:' + alpha * mass * 6 + ' liter:' + liters + ' time:' + Whirlpool7 + ' ibu' + (alpha * mass * 6) / liters * (Whirlpool7 / 50));
+  }
+  if (Whirlpool6) {
+   // 2 mg/l/50 min
+   whirlibus += (alpha * mass * 2) / liters * (Whirlpool6 / 50);
+   console.log('Whirlpool6:' + alpha * mass * 2 + ' liter:' + liters + ' time:' + Whirlpool6 + ' ibu' + (alpha * mass * 2) / liters * (Whirlpool6 / 50));
+  }
+ }
+
  if (Method == 0) { // Tinseth
   /* http://realbeer.com/hops/research.html */
   AddedAlphaAcids = (alpha * mass * 1000) / liters;
   Bigness_factor = 1.65 * Math.pow(0.000125, gravity - 1);
   BoilTime_factor = ((1 - Math.exp(-0.04 * time)) / 4.15);
   utiisation = Bigness_factor * BoilTime_factor;
-  ibu = Round(utiisation * AddedAlphaAcids * fmoment * pfactor, 1);
+  ibu = Round(utiisation * AddedAlphaAcids * fmoment * pfactor + whirlibus, 1);
  }
  if (Method == 2) { // Daniels
   if (Form == 2) // Leaf
@@ -918,7 +938,7 @@
    sgfactor = 0;
   else
    sgfactor = (gravity - 1050) / 200;
-  ibu = Round(fmoment * ((mass * (alpha * 100) * boilfactor * 0.1) / (liters * (1 + sgfactor))), 1);
+  ibu = Round(fmoment * ((mass * (alpha * 100) * boilfactor * 0.1) / (liters * (1 + sgfactor))) + whirlibus, 1);
  }
  if (Method == 1) { // Rager
   boilfactor = fmoment * 18.11 + 13.86 * Math.tanh((time * 31.32) / 18.27);
@@ -926,10 +946,11 @@
    sgfactor = 0;
   else
    sgfactor = (gravity - 1050) / 200;
-  ibu = Round((mass * (alpha * 100) * boilfactor * 0.1) / (liters * (1 + sgfactor)), 1);
+  ibu = Round((mass * (alpha * 100) * boilfactor * 0.1) / (liters * (1 + sgfactor)) + whirlibus, 1);
  }
 
- //console.log("toIBU("+Use+","+Form+","+SG+","+Volume+","+Amount+","+Boiltime+","+Alpha+","+Method+"):"+ibu+" fm:"+fmoment+" pf:"+pfactor);
+// console.log('toIBU(' + Use + ',' + Form + ',' + SG + ',' + Volume + ',' + Amount + ',' + Boiltime + ',' +
+//             Alpha + ',' + Method + ',' + Whirlpool9 + ',' + Whirlpool7 + ',' + Whirlpool6 + '):' + ibu + ' fm:' + fmoment + ' pf:' + pfactor);
  return ibu;
 }
 

mercurial