www/includes/formulas.php

changeset 231
9881453a49b3
parent 164
0a5abea575a9
child 243
b43214d218c0
equal deleted inserted replaced
230:8edca0488e65 231:9881453a49b3
179 /* 179 /*
180 * Kleurwerking naar SRM 180 * Kleurwerking naar SRM
181 */ 181 */
182 function kw_to_srm($colormethod, $c) { 182 function kw_to_srm($colormethod, $c) {
183 183
184 if ($colormethod == "Morey") 184 if ($colormethod == 0) // Morey
185 return 1.4922 * pow($c, 0.6859); 185 return 1.4922 * pow($c, 0.6859);
186 if ($colormethod == "Mosher") 186 if ($colormethod == 1) // Mosher
187 return 0.3 * $c + 4.7; 187 return 0.3 * $c + 4.7;
188 if ($colormethod == "Daniels") 188 if ($colormethod == 2) // Daniels
189 return 0.2 * $c + 8.4; 189 return 0.2 * $c + 8.4;
190 } 190 }
191 191
192 192
193 193
203 global $my_factor_fwh; 203 global $my_factor_fwh;
204 global $my_factor_pellet; 204 global $my_factor_pellet;
205 global $my_factor_plug; 205 global $my_factor_plug;
206 206
207 $fmoment = 1.0; 207 $fmoment = 1.0;
208 if (($useat == "Dry Hop") || ($useat == "Dry hop") || ($useat == "Whirlpool") || ($useat == "Aroma")) { 208 if (($useat == 5) || ($useat == 4) || ($useat == 3)) { // Dry hop, Whirlpool or Aroma
209 $fmoment = 0.0; 209 $fmoment = 0.0;
210 } else if ($useat == "Mash") { 210 } else if ($useat == 0) { // Mash
211 $fmoment += $my_factor_mashhop / 100; // Brouwhulp 211 $fmoment += $my_factor_mashhop / 100; // Brouwhulp
212 } else if (($useat == "First Wort") || ($useat == "First wort")) { 212 } else if ($useat == 1) { // First wort
213 $fmoment += $my_factor_fwh / 100; // Brouwhulp, Louis, Ozzie 213 $fmoment += $my_factor_fwh / 100; // Brouwhulp, Louis, Ozzie
214 } 214 }
215 215
216 $pfactor = 1.0; 216 $pfactor = 1.0;
217 if ($form == "Pellet") { 217 if ($form == 0) { // Pellets
218 $pfactor += $my_factor_pellet / 100; 218 $pfactor += $my_factor_pellet / 100;
219 } 219 }
220 if ($form == "Plug") { 220 if ($form == 1) { // Plugs
221 $pfactor += $my_factor_plug / 100; 221 $pfactor += $my_factor_plug / 100;
222 } 222 }
223 223
224 $ibu = 0; 224 $ibu = 0;
225 if (($method == "Tinseth") || ($method == "Garetz")) { // For Garetz, we need the $ibu 225 if (($method == 0) || ($method == 3)) { // Tinseth or Garetz // For Garetz, we need the $ibu
226 $AddedAlphaAcids = (($alpha / 100) * $mass * 1000) / $volume; 226 $AddedAlphaAcids = (($alpha / 100) * $mass * 1000) / $volume;
227 $Bigness_factor = 1.65 * pow( 0.000125, $sg - 1); 227 $Bigness_factor = 1.65 * pow( 0.000125, $sg - 1);
228 $BoilTime_factor = ((1 - exp(-0.04 * $boiltime)) / 4.15); 228 $BoilTime_factor = ((1 - exp(-0.04 * $boiltime)) / 4.15);
229 $utiisation = $Bigness_factor * $BoilTime_factor; 229 $utiisation = $Bigness_factor * $BoilTime_factor;
230 $ibu = (round($utiisation * $AddedAlphaAcids * $fmoment * $pfactor * 10) / 10.0); 230 $ibu = (round($utiisation * $AddedAlphaAcids * $fmoment * $pfactor * 10) / 10.0);
231 } 231 }
232 if ($method == "Daniels") { 232 if ($method == 2) { // Daniels
233 233
234 if ($form == "Leaf") 234 if ($form == 2) // Leaf
235 $boilfactor = -(0.0041*$boiltime*$boiltime)+(0.6162*$boiltime)+1.5779; 235 $boilfactor = -(0.0041*$boiltime*$boiltime)+(0.6162*$boiltime)+1.5779;
236 else 236 else
237 $boilfactor = -(0.0051*$boiltime*$boiltime)+(0.7835*$boiltime)+1.9348; 237 $boilfactor = -(0.0051*$boiltime*$boiltime)+(0.7835*$boiltime)+1.9348;
238 if ($sg < 1.050) 238 if ($sg < 1.050)
239 $sgfactor = 0; 239 $sgfactor = 0;
240 else 240 else
241 $sgfactor = (($sg * 1000) - 1050) / 200; 241 $sgfactor = (($sg * 1000) - 1050) / 200;
242 $ibu = $fmoment * (($mass * $alpha * $boilfactor * 0.1) / ($volume * (1 + $sgfactor))); 242 $ibu = $fmoment * (($mass * $alpha * $boilfactor * 0.1) / ($volume * (1 + $sgfactor)));
243 } 243 }
244 if ($method == "Rager") { 244 if ($method == 1) { // Rager
245 $boilfactor = $fmoment * 18.11 + 13.86 * tanh(($boiltime * 31.32) / 18.27); 245 $boilfactor = $fmoment * 18.11 + 13.86 * tanh(($boiltime * 31.32) / 18.27);
246 if ($sg < 1.050) 246 if ($sg < 1.050)
247 $sgfactor = 0; 247 $sgfactor = 0;
248 else 248 else
249 $sgfactor = (($sg * 1000) - 1050) / 200; 249 $sgfactor = (($sg * 1000) - 1050) / 200;
250 $ibu = ($mass * $alpha * $boilfactor * 0.1) / ($volume * (1 + $sgfactor)); 250 $ibu = ($mass * $alpha * $boilfactor * 0.1) / ($volume * (1 + $sgfactor));
251 } 251 }
252 if ($method == "Garetz") { 252 if ($method == 3) { // Garetz, not in use.
253 /* Something is wrong, late hops and dryhops give negative results. */ 253 /* Something is wrong, late hops and dryhops give negative results. */
254 $boilfactor = $fmoment * 6.03253 + 16.5289 * tanh(($boiltime - 19.17323) / 26.8013); 254 $boilfactor = $fmoment * 6.03253 + 16.5289 * tanh(($boiltime - 19.17323) / 26.8013);
255 $cfactor = $volume / (1.1 * $volume); // ConcentratieFactor = (Volume na koelen) / (Volume bij Koken) 255 $cfactor = $volume / (1.1 * $volume); // ConcentratieFactor = (Volume na koelen) / (Volume bij Koken)
256 $kookdichtheid = ($cfactor * (($sg * 1000) - 1000) / 1000) + 1; 256 $kookdichtheid = ($cfactor * (($sg * 1000) - 1000) / 1000) + 1;
257 $sgfactor = ($kookdichtheid - 1.05) / 0.2 + 1; 257 $sgfactor = ($kookdichtheid - 1.05) / 0.2 + 1;

mercurial