# HG changeset patch # User Michiel Broek # Date 1572212368 -3600 # Node ID fe9ac6d49c4f128057fa069002cee5a73ddd515a # Parent 41d21817608ef7382c1674523a79fe6df7e67ba3 Printed outputs have IBUs for whirlpool hops. Removed some debug console logs. diff -r 41d21817608e -r fe9ac6d49c4f www/includes/formulas.php --- a/www/includes/formulas.php Sun Oct 27 20:20:09 2019 +0100 +++ b/www/includes/formulas.php Sun Oct 27 22:39:28 2019 +0100 @@ -202,7 +202,7 @@ -function calc_IBU($useat, $form, $sg, $volume, $mass, $boiltime, $alpha, $method) +function calc_IBU($useat, $form, $sg, $volume, $mass, $boiltime, $alpha, $method, $whirlpool9, $whirlpool7, $whirlpool6) { global $my_factor_mashhop; global $my_factor_fwh; @@ -234,13 +234,23 @@ $pfactor += $my_factor_cryohop / 100; } + $whirlibus = 0; + if ($useat == 4) { // Any whirlpool + if ($whirlpool9) + $whirlibus += ($mass * ($alpha / 100) * 20) / $volume * $whirlpool9 / 50; + if ($whirlpool7) + $whirlibus += ($mass * ($alpha / 100) * 6) / $volume * $whirlpool7 / 50; + if ($whirlpool6) + $whirlibus += ($mass * ($alpha / 100) * 2) / $volume * $whirlpool6 / 50; + } + $ibu = 0; if (($method == 0) || ($method == 3)) { // Tinseth or Garetz // For Garetz, we need the $ibu $AddedAlphaAcids = (($alpha / 100) * $mass * 1000) / $volume; $Bigness_factor = 1.65 * pow( 0.000125, $sg - 1); $BoilTime_factor = ((1 - exp(-0.04 * $boiltime)) / 4.15); $utiisation = $Bigness_factor * $BoilTime_factor; - $ibu = (round($utiisation * $AddedAlphaAcids * $fmoment * $pfactor * 10) / 10.0); + $ibu = (round(($utiisation * $AddedAlphaAcids * $fmoment * $pfactor + $whirlibus) * 10) / 10.0); } if ($method == 2) { // Daniels @@ -252,7 +262,7 @@ $sgfactor = 0; else $sgfactor = (($sg * 1000) - 1050) / 200; - $ibu = $fmoment * (($mass * $alpha * $boilfactor * 0.1) / ($volume * (1 + $sgfactor))); + $ibu = $fmoment * (($mass * $alpha * $boilfactor * 0.1) / ($volume * (1 + $sgfactor))) + $whirlibus; } if ($method == 1) { // Rager $boilfactor = $fmoment * 18.11 + 13.86 * tanh(($boiltime * 31.32) / 18.27); @@ -260,7 +270,7 @@ $sgfactor = 0; else $sgfactor = (($sg * 1000) - 1050) / 200; - $ibu = ($mass * $alpha * $boilfactor * 0.1) / ($volume * (1 + $sgfactor)); + $ibu = ($mass * $alpha * $boilfactor * 0.1) / ($volume * (1 + $sgfactor)) + $whirlibus; } if ($method == 3) { // Garetz, not in use. /* Something is wrong, late hops and dryhops give negative results. */ diff -r 41d21817608e -r fe9ac6d49c4f www/js/global.js --- a/www/js/global.js Sun Oct 27 20:20:09 2019 +0100 +++ b/www/js/global.js Sun Oct 27 22:39:28 2019 +0100 @@ -907,17 +907,17 @@ 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)); + //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)); + //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)); + //console.log('Whirlpool6:' + alpha * mass * 2 + ' liter:' + liters + ' time:' + Whirlpool6 + ' ibu' + (alpha * mass * 2) / liters * (Whirlpool6 / 50)); } } diff -r 41d21817608e -r fe9ac6d49c4f www/js/prod_edit.js --- a/www/js/prod_edit.js Sun Oct 27 20:20:09 2019 +0100 +++ b/www/js/prod_edit.js Sun Oct 27 22:39:28 2019 +0100 @@ -823,15 +823,12 @@ { name: 'h_avail', type: 'int' } ], addrow: function(rowid, rowdata, position, commit) { - console.log('hop addrow ' + rowid); commit(true); }, deleterow: function(rowid, commit) { - console.log('hop deleterow ' + rowid); commit(true); }, updaterow: function(rowid, rowdata, commit) { - console.log('hop updaterow ' + rowid); commit(true); } }, @@ -1030,15 +1027,12 @@ { name: 'm_avail', type: 'int' } ], addrow: function(rowid, rowdata, position, commit) { - console.log('misc addrow ' + rowid); commit(true); }, deleterow: function(rowid, commit) { - console.log('misc deleterow ' + rowid); commit(true); }, updaterow: function(rowid, rowdata, commit) { - console.log('misc updaterow ' + rowid); commit(true); } }, @@ -2418,9 +2412,8 @@ }; function whirlpoolHops() { - console.log('whirlpoolHops()'); var row, i, time, rowscount; - if (!(rowscount = $('#hopGrid').jqxGrid('getdatainformation').rowscount)) + if (!(rowscount = $('#hopGrid').jqxGrid('getdatainformation').rowscount)) return; if (rowscount == 0) return; diff -r 41d21817608e -r fe9ac6d49c4f www/prod_forum.php --- a/www/prod_forum.php Sun Oct 27 20:20:09 2019 +0100 +++ b/www/prod_forum.php Sun Oct 27 22:39:28 2019 +0100 @@ -127,7 +127,8 @@ $amount = floatval($item['h_amount']) * 1000; $time = floatval($item['h_time']); $alpha = floatval($item['h_alpha']); - $ibu = calc_IBU($item['h_useat'], $item['h_form'], $preboil_sg, floatval($row['batch_size']), $amount, $time, $alpha, $row['ibu_method']); + $ibu = calc_IBU($item['h_useat'], $item['h_form'], $preboil_sg, floatval($row['batch_size']), $amount, $time, $alpha, + $row['ibu_method'], $row['brew_whirlpool9'], $row['brew_whirlpool7'], $row['brew_whirlpool6']); $moment = $hopuse[$item['h_useat']]; if (($item['h_useat'] == 2) || ($item['h_useat'] == 4)) { // Boil or Whirlpool $moment = $hopuse[$item['h_useat']].' '.$time." minuten"; diff -r 41d21817608e -r fe9ac6d49c4f www/prod_print.php --- a/www/prod_print.php Sun Oct 27 20:20:09 2019 +0100 +++ b/www/prod_print.php Sun Oct 27 22:39:28 2019 +0100 @@ -260,7 +260,8 @@ } else if ($item['h_useat'] == 5) { // Dryhop $moment = $hopuse[$item['h_useat']].' '.sprintf("%.0f", $time / 1440).' dagen'; } - $ibu = calc_IBU($item['h_useat'], $item['h_form'], $preboil_sg, floatval($row['batch_size']), $mass, $time, $alpha, $row['ibu_method']); + $ibu = calc_IBU($item['h_useat'], $item['h_form'], $preboil_sg, floatval($row['batch_size']), $mass, $time, $alpha, + $row['ibu_method'], $row['brew_whirlpool9'], $row['brew_whirlpool7'], $row['brew_whirlpool6']); $total_ibus += $ibu; if ($amount > 1) diff -r 41d21817608e -r fe9ac6d49c4f www/rec_forum.php --- a/www/rec_forum.php Sun Oct 27 20:20:09 2019 +0100 +++ b/www/rec_forum.php Sun Oct 27 22:39:28 2019 +0100 @@ -127,7 +127,8 @@ $amount = floatval($item['h_amount']) * 1000; $time = floatval($item['h_time']); $alpha = floatval($item['h_alpha']); - $ibu = calc_IBU($item['h_useat'], $item['h_form'], $preboil_sg, floatval($row['batch_size']), $amount, $time, $alpha, $row['ibu_method']); + $ibu = calc_IBU($item['h_useat'], $item['h_form'], $preboil_sg, floatval($row['batch_size']), $amount, $time, $alpha, + $row['ibu_method'], $row['brew_whirlpool9'], $row['brew_whirlpool7'], $row['brew_whirlpool6']); $moment = $hopuse[$item['h_useat']]; if (($item['h_useat'] == 2) || ($item['h_useat'] == 4)) { // Boil or Whirlpool $moment = $hopuse[$item['h_useat']].' '.$time." minuten"; diff -r 41d21817608e -r fe9ac6d49c4f www/rec_print.php --- a/www/rec_print.php Sun Oct 27 20:20:09 2019 +0100 +++ b/www/rec_print.php Sun Oct 27 22:39:28 2019 +0100 @@ -230,7 +230,8 @@ } else if ($item['h_useat'] == 5) { // Dryhop $moment = $hopuse[$item['h_useat']].' '.sprintf("%.0f", $time / 1440).' dagen'; } - $ibu = calc_IBU($item['h_useat'], $item['h_form'], $preboil_sg, floatval($row['batch_size']), $mass, $time, $alpha, $row['ibu_method']); + $ibu = calc_IBU($item['h_useat'], $item['h_form'], $preboil_sg, floatval($row['batch_size']), $mass, $time, $alpha, + $row['ibu_method'], $row['brew_whirlpool9'], $row['brew_whirlpool7'], $row['brew_whirlpool6']); $total_ibus += $ibu; if ($amount > 1)