200 return srm_to_ebc(kw_to_srm($colormethod, $c)); |
200 return srm_to_ebc(kw_to_srm($colormethod, $c)); |
201 } |
201 } |
202 |
202 |
203 |
203 |
204 |
204 |
205 function calc_IBU($useat, $form, $sg, $volume, $mass, $boiltime, $alpha, $method) |
205 function calc_IBU($useat, $form, $sg, $volume, $mass, $boiltime, $alpha, $method, $whirlpool9, $whirlpool7, $whirlpool6) |
206 { |
206 { |
207 global $my_factor_mashhop; |
207 global $my_factor_mashhop; |
208 global $my_factor_fwh; |
208 global $my_factor_fwh; |
209 global $my_factor_pellet; |
209 global $my_factor_pellet; |
210 global $my_factor_plug; |
210 global $my_factor_plug; |
232 } |
232 } |
233 if ($form == 4) { // Cryo hop |
233 if ($form == 4) { // Cryo hop |
234 $pfactor += $my_factor_cryohop / 100; |
234 $pfactor += $my_factor_cryohop / 100; |
235 } |
235 } |
236 |
236 |
|
237 $whirlibus = 0; |
|
238 if ($useat == 4) { // Any whirlpool |
|
239 if ($whirlpool9) |
|
240 $whirlibus += ($mass * ($alpha / 100) * 20) / $volume * $whirlpool9 / 50; |
|
241 if ($whirlpool7) |
|
242 $whirlibus += ($mass * ($alpha / 100) * 6) / $volume * $whirlpool7 / 50; |
|
243 if ($whirlpool6) |
|
244 $whirlibus += ($mass * ($alpha / 100) * 2) / $volume * $whirlpool6 / 50; |
|
245 } |
|
246 |
237 $ibu = 0; |
247 $ibu = 0; |
238 if (($method == 0) || ($method == 3)) { // Tinseth or Garetz // For Garetz, we need the $ibu |
248 if (($method == 0) || ($method == 3)) { // Tinseth or Garetz // For Garetz, we need the $ibu |
239 $AddedAlphaAcids = (($alpha / 100) * $mass * 1000) / $volume; |
249 $AddedAlphaAcids = (($alpha / 100) * $mass * 1000) / $volume; |
240 $Bigness_factor = 1.65 * pow( 0.000125, $sg - 1); |
250 $Bigness_factor = 1.65 * pow( 0.000125, $sg - 1); |
241 $BoilTime_factor = ((1 - exp(-0.04 * $boiltime)) / 4.15); |
251 $BoilTime_factor = ((1 - exp(-0.04 * $boiltime)) / 4.15); |
242 $utiisation = $Bigness_factor * $BoilTime_factor; |
252 $utiisation = $Bigness_factor * $BoilTime_factor; |
243 $ibu = (round($utiisation * $AddedAlphaAcids * $fmoment * $pfactor * 10) / 10.0); |
253 $ibu = (round(($utiisation * $AddedAlphaAcids * $fmoment * $pfactor + $whirlibus) * 10) / 10.0); |
244 } |
254 } |
245 if ($method == 2) { // Daniels |
255 if ($method == 2) { // Daniels |
246 |
256 |
247 if ($form == 2) // Leaf |
257 if ($form == 2) // Leaf |
248 $boilfactor = -(0.0041*$boiltime*$boiltime)+(0.6162*$boiltime)+1.5779; |
258 $boilfactor = -(0.0041*$boiltime*$boiltime)+(0.6162*$boiltime)+1.5779; |
250 $boilfactor = -(0.0051*$boiltime*$boiltime)+(0.7835*$boiltime)+1.9348; |
260 $boilfactor = -(0.0051*$boiltime*$boiltime)+(0.7835*$boiltime)+1.9348; |
251 if ($sg < 1.050) |
261 if ($sg < 1.050) |
252 $sgfactor = 0; |
262 $sgfactor = 0; |
253 else |
263 else |
254 $sgfactor = (($sg * 1000) - 1050) / 200; |
264 $sgfactor = (($sg * 1000) - 1050) / 200; |
255 $ibu = $fmoment * (($mass * $alpha * $boilfactor * 0.1) / ($volume * (1 + $sgfactor))); |
265 $ibu = $fmoment * (($mass * $alpha * $boilfactor * 0.1) / ($volume * (1 + $sgfactor))) + $whirlibus; |
256 } |
266 } |
257 if ($method == 1) { // Rager |
267 if ($method == 1) { // Rager |
258 $boilfactor = $fmoment * 18.11 + 13.86 * tanh(($boiltime * 31.32) / 18.27); |
268 $boilfactor = $fmoment * 18.11 + 13.86 * tanh(($boiltime * 31.32) / 18.27); |
259 if ($sg < 1.050) |
269 if ($sg < 1.050) |
260 $sgfactor = 0; |
270 $sgfactor = 0; |
261 else |
271 else |
262 $sgfactor = (($sg * 1000) - 1050) / 200; |
272 $sgfactor = (($sg * 1000) - 1050) / 200; |
263 $ibu = ($mass * $alpha * $boilfactor * 0.1) / ($volume * (1 + $sgfactor)); |
273 $ibu = ($mass * $alpha * $boilfactor * 0.1) / ($volume * (1 + $sgfactor)) + $whirlibus; |
264 } |
274 } |
265 if ($method == 3) { // Garetz, not in use. |
275 if ($method == 3) { // Garetz, not in use. |
266 /* Something is wrong, late hops and dryhops give negative results. */ |
276 /* Something is wrong, late hops and dryhops give negative results. */ |
267 $boilfactor = $fmoment * 6.03253 + 16.5289 * tanh(($boiltime - 19.17323) / 26.8013); |
277 $boilfactor = $fmoment * 6.03253 + 16.5289 * tanh(($boiltime - 19.17323) / 26.8013); |
268 $cfactor = $volume / (1.1 * $volume); // ConcentratieFactor = (Volume na koelen) / (Volume bij Koken) |
278 $cfactor = $volume / (1.1 * $volume); // ConcentratieFactor = (Volume na koelen) / (Volume bij Koken) |