Sat, 17 Nov 2018 20:40:23 +0100
IBU calculations now use the setup values. All setup values are now global available.
--- a/www/includes/formulas.php Sat Nov 17 19:44:39 2018 +0100 +++ b/www/includes/formulas.php Sat Nov 17 20:40:23 2018 +0100 @@ -197,23 +197,28 @@ -function calc_IBU($useat, $form, $sg, $volume, $mass, $boiltime, $alpha, $method) { +function calc_IBU($useat, $form, $sg, $volume, $mass, $boiltime, $alpha, $method) +{ + global $my_factor_mashhop; + global $my_factor_fwh; + global $my_factor_pellet; + global $my_factor_plug; $fmoment = 1.0; if (($useat == "Dry Hop") || ($useat == "Dry hop") || ($useat == "Whirlpool") || ($useat == "Aroma")) { $fmoment = 0.0; } else if ($useat == "Mash") { - $fmoment += /* Settings.MashHopFactor.Value = -30% */ -30 / 100; // Brouwhulp + $fmoment += $my_factor_mashhop / 100; // Brouwhulp } else if (($useat == "First Wort") || ($useat == "First wort")) { - $fmoment += /* Settings.FWHFactor.Value = 10% */ 10 / 100; // Brouwhulp, Louis, Ozzie + $fmoment += $my_factor_fwh / 100; // Brouwhulp, Louis, Ozzie } $pfactor = 1.0; if ($form == "Pellet") { - $pfactor += /* Settings.PelletFactor.Value = 10% */ 10 / 100; + $pfactor += $my_factor_pellet / 100; } if ($form == "Plug") { - $pfactor += /* Settings.PlugFactor.Value = 2% */ 2 / 100; + $pfactor += $my_factor_plug / 100; } $ibu = 0;
--- a/www/includes/global.inc.php Sat Nov 17 19:44:39 2018 +0100 +++ b/www/includes/global.inc.php Sat Nov 17 20:40:23 2018 +0100 @@ -78,6 +78,15 @@ global $my_record; global $my_return; global $my_brewery_name; + global $my_factor_mashhop; + global $my_factor_fwh; + global $my_factor_pellet; + global $my_factor_plug; + global $my_ibu_method; + global $my_color_method; + global $my_brix_correction; + global $my_grain_absorbtion; + global $my_default_water; ?> <!DOCTYPE html> <html lang=nl-NL> @@ -93,6 +102,15 @@ var my_record = "<?php echo $my_record; ?>"; var my_return = "<?php echo $my_return; ?>"; var my_brewery_name = "<?php echo $my_brewery_name; ?>"; + var my_factor_mashhop = "<?php echo $my_factor_mashhop; ?>"; + var my_factor_fwh = "<?php echo $my_factor_fwh; ?>"; + var my_factor_pellet = "<?php echo $my_factor_pellet; ?>"; + var my_factor_plug = "<?php echo $my_factor_plug; ?>"; + var my_ibu_method = "<?php echo $my_ibu_method; ?>"; + var my_color_method = "<?php echo $my_color_method; ?>"; + var my_brix_correction = "<?php echo $my_brix_correction; ?>"; + var my_grain_absorbtion = "<?php echo $my_grain_absorbtion; ?>"; + var my_default_water = "<?php echo $my_default_water; ?>"; </script> <script src="js/jquery-1.11.1.min.js"></script> <script src="jqwidgets/jqxcore.js"></script>
--- a/www/js/global.js Sat Nov 17 19:44:39 2018 +0100 +++ b/www/js/global.js Sat Nov 17 20:40:23 2018 +0100 @@ -126,7 +126,8 @@ /* * 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) +{ var gravity = parseFloat(SG); var liters = parseFloat(Volume); var alpha = parseFloat(Alpha)/100; @@ -139,16 +140,16 @@ if ((Use == "Dry Hop") || (Use == "Dry hop") || (Use == "Whirlpool") || (Use == "Aroma")) { fmoment = 0.0; } else if (Use == "Mash") { - fmoment += /* Settings.MashHopFactor.Value = -30% */ -30 / 100; // Brouwhulp + fmoment += my_factor_mashhop / 100; // Brouwhulp } else if ((Use == "First Wort") || (Use == "First wort")) { - fmoment += /* Settings.FWHFactor.Value = 10% */ 10 / 100; // Brouwhulp, Louis, Ozzie + fmoment += my_factor_fwh / 100; // Brouwhulp, Louis, Ozzie } if (Form == "Pellet") { - pfactor += /* Settings.PelletFactor.Value = 10% */ 10 / 100; + pfactor += my_factor_pellet / 100; } if (Form == "Plug" ) { - pfactor += /* Settings.PlugFactor.Value = 2% */ 2 / 100; + pfactor += my_factor_plug / 100; } if (Method == "Tinseth") { @@ -183,7 +184,7 @@ ibu = Math.round((mass * (alpha * 100) * boilfactor * 0.1) / (liters * (1 + sgfactor)) * 10) / 10; } - console.log("toIBU("+Use+"," + Form + "," + SG + "," + Volume + "," + Amount + "," + Boiltime + "," + Alpha + "," + Method + ") :" + ibu); + console.log("toIBU("+Use+","+Form+","+SG+","+Volume+","+Amount+","+Boiltime+","+Alpha+","+Method+"):"+ibu+" fm:"+fmoment+" pf:"+pfactor); return ibu; }