$ibu_R = array_fill(0, MAX_HOPS, NULL); for ($i = 0; $i < MAX_HOPS; $i++) { if (!isset($hopWeight[$i])) { continue; } $ibu_R[$i] = calc_bitter_rager($utilization[$i], $gravity, $hopAA[$i], $hopWeight[$i], $finalVol, $form[$i], $units); $ibuR += $ibu_R[$i]; } // Daniels Method $ibuD = 0; $ibu_D = array_fill(0, MAX_HOPS, NULL); for ($i = 0; $i < MAX_HOPS; $i++) { if (!isset($hopWeight[$i])) { continue; } $ibu_D[$i] = calc_bitter_daniels($utilization[$i], $gravity, $hopAA[$i], $hopWeight[$i], $finalVol, $form[$i], $units); $ibuD += $ibu_D[$i]; } // Garetz Method $ibuG = 0; $ibu_G = array_fill(0, MAX_HOPS, NULL); if ($preBoilVol > 0 && $desiredIBUs > 0 && $elevation >= 0) { for ($i = 0; $i < MAX_HOPS; $i++) { if (!isset($hopWeight[$i])) { continue; } $ibu_G[$i] = calc_bitter_garetz($utilization[$i], $gravity, $hopAA[$i], $hopWeight[$i], $finalVol, $form[$i], $units, $preBoilVol, $desiredIBUs, $elevation); $ibuG += $ibu_G[$i]; } } }
// ------------------------------ Calculations ----------------------------------- // $units = $measureWeight1 == "grams" ? "metric" : "us"; $ibuT = 0; $ibuD = 0; $ibuG = 0; $ibuR = 0; $ibuAvg = 0; if ($og > 1.0 && $brewYield > 0) { for ($i = 0; $i < MAX_HOPS; $i++) { if ($hopsWeight[$i] && $hopsAA[$i]) { $hopsAAU[$i] = $hopsWeight[$i] * $hopsAA[$i]; if ($hopsTime[$i] && $hopsForm[$i]) { $format = $hopsForm[$i] == "Pellet" ? "pellet" : "whole"; $ibuT += calc_bitter_tinseth($hopsTime[$i], $og, $hopsAA[$i], $hopsWeight[$i], $brewYield, $format, $units); $ibuR += calc_bitter_rager($hopsTime[$i], $og, $hopsAA[$i], $hopsWeight[$i], $brewYield, $format, $units); $ibuD += calc_bitter_daniels($hopsTime[$i], $og, $hopsAA[$i], $hopsWeight[$i], $brewYield, $format, $units); $ibuG += 0; // Not enough data to do calc properly } } } } $ibuAvg = $ibuT + $ibuR + $ibuD; if ($ibuAvg > 0) { if ($ibuG > 0) { $ibuAvg += $ibuG; $ibuAvg /= 4; } else { $ibuAvg /= 3; } if ($results != "verify") {