www/includes/formulas.php

changeset 428
a5d4467c9201
parent 392
544d7d0183b2
child 446
ee7bcfb8e270
equal deleted inserted replaced
425:7671a5fc5171 428:a5d4467c9201
287 $brix = $plato * $my_brix_correction; 287 $brix = $plato * $my_brix_correction;
288 return sprintf("%.3f", floatval($sg))." SG ".sprintf("%.1f",$brix).DEG.'Brix '.sprintf("%.1f",$plato).DEG.'P'; 288 return sprintf("%.3f", floatval($sg))." SG ".sprintf("%.1f",$brix).DEG.'Brix '.sprintf("%.1f",$plato).DEG.'P';
289 } 289 }
290 290
291 291
292
293 /*
294
295 Brouwhulp data.pas
296
297
298
299 Procedure TFermentable.SetpHParameters(force : boolean);
300 var x, ebc : double;
301 begin
302 if Between(FDIpH.Value, -0.01, 0.01) or Between(FAcidTo57.Value, -0.1, 0.1) or force then
303 begin
304 ebc:= SRMtoEBC(FColor.Value);
305 case FGrainType of
306 gtBase, gtKilned:
307 begin
308 FDIpH.Value:= -0.0132 * ebc + 5.7605;
309 x:= 0.4278 * ebc - 1.8106;
310 FAcidTo57.Value:= x;
311 end;
312 gtRoast:
313 begin
314 FDIpH.Value:= 0.00018 * ebc + 4.558;
315 FAcidTo57.Value:= -0.0176 * ebc + 60.04;
316 end;
317 gtCrystal:
318 begin
319 FDIpH.Value:= -0.0019 * ebc + 5.2175;
320 FAcidTo57.Value:= 0.132 * ebc + 14.277;
321 end;
322 gtSour:
323 begin
324 FDIpH.Value:= 3.44;
325 FAcidTo57.Value:= 337;
326 end;
327 gtSpecial: //this could be anything. Assume for now it is a non-acidulated base or kilned malt
328 begin
329 FDIpH.Value:= -0.0132 * ebc + 5.7605;
330 FAcidTo57.Value:= 0.4278 * ebc - 1.8106;
331 end;
332 end;
333 end;
334 //known parameters should be filled in here
335 if FSupplier.Value = 'Weyermann' then
336 begin
337 if FName.Value = 'Vienna mout' then
338 begin
339 FDIpH.Value:= 5.65;
340 FAcidTo57.Value:= 1.6;
341 end;
342 if FName.Value = 'Münchner I' then
343 begin
344 FDIpH.Value:= 5.44;
345 FAcidTo57.Value:= 8.4;
346 end;
347 if FName.Value = 'Münchner II' then
348 begin
349 FDIpH.Value:= 5.54;
350 FAcidTo57.Value:= 5.6;
351 end;
352 if FName.Value = 'Caramunich I' then
353 begin
354 FDIpH.Value:= 5.1;
355 FAcidTo57.Value:= 22.4;
356 end;
357 if FName.Value = 'Caramunich II' then
358 begin
359 FDIpH.Value:= 4.71;
360 FAcidTo57.Value:= 49;
361 end;
362 if FName.Value = 'Caramunich III' then
363 begin
364 FDIpH.Value:= 4.92;
365 FAcidTo57.Value:= 31.2;
366 end;
367 if FName.Value = 'Cara-aroma' then
368 begin
369 FDIpH.Value:= 4.48;
370 FAcidTo57.Value:= 74.4;
371 end;
372 if FName.Value = 'Carafa I' then
373 begin
374 FDIpH.Value:= 4.71;
375 FAcidTo57.Value:= 42;
376 end;
377 if FName.Value = 'Carafa III' then
378 begin
379 FDIpH.Value:= 4.81;
380 FAcidTo57.Value:= 35.4;
381 end;
382 if FName.Value = 'Carafa II' then
383 begin
384 FDIpH.Value:= 4.76;
385 FAcidTo57.Value:= 38.7;
386 end;
387 if FName.Value = 'Carafa Special I' then
388 begin
389 FDIpH.Value:= 4.73;
390 FAcidTo57.Value:= 46.4;
391 end;
392 if FName.Value = 'Carafa Special II' then
393 begin
394 FDIpH.Value:= 4.78;
395 FAcidTo57.Value:= 42.9;
396 end;
397 if FName.Value = 'Carafa Special III' then
398 begin
399 FDIpH.Value:= 4.83;
400 FAcidTo57.Value:= 38.9;
401 end;
402 if IsInString(FName.Value, 'Zuurmout') then
403 begin
404 FDIpH.Value:= 3.44;
405 FAcidTo57.Value:= 358.2;
406 end;
407 end;
408 end;
409
410
411 function TFermentable.GetExtract: double;
412 begin
413 Result := 0;
414 if FRecipe <> nil then
415 begin
416 Result := FAmount.Value * FYield.Value / 100 * (1 - FMoisture.Value / 100);
417 if FAdded = atMash then
418 Result := Result * FRecipe.Efficiency / 100;
419 end;
420 end;
421
422
423 function TFermentable.GetKolbachIndex: double;
424 begin
425 if FProtein.Value > 0 then
426 Result := FDissolvedProtein.Value / FProtein.Value
427 else
428 Result := 0;
429 end;
430
431
432 function TWater.GetResidualAlkalinity: double;
433 begin
434 //Result in mg/l as CaCO3
435 Result:= FTotalAlkalinity.Value - (FCalcium.Value / 1.4 + FMagnesium.Value / 1.7);
436 end;
437
438
439 function TWater.GetHardness: double;
440 begin
441 Result := 0.14 * FCalcium.Value - 0.23 * FMagnesium.Value;
442 end;
443
444 function TWater.GetEstPhMash: double;
445 {var
446 pHdemi, S: double;}
447 begin
448 Result:= MashpH;
449 { Result := 0;
450 if FRecipe <> nil then
451 begin
452 pHDemi := FRecipe.pHdemi;
453 S := 0.013 * FRecipe.MashThickness + 0.013;
454 Result := pHDemi + ResidualAlkalinity / 50 * S;
455 end;}
456 end;
457
458
459
460
461
462 Procedure TRecipe.CalcCalories;
463 var sug, alc, org, fig : double;
464 begin
465 if FOGFermenter.Value > 1.001 then org:= FOGFermenter.Value
466 else if FOG.Value > 1.001 then org:= FOG.Value
467 else org:= 0;
468 if FFG.Value > 0.999 then fig:= FFG.Value
469 else if FEstFG.Value > 1.000 then fig:= FEstFG.Value
470 else if FEstFG2.Value > 1.000 then fig:= FEstFG2.Value
471 else fig:= 0;
472 if (org > 0) and (fig > 0) then
473 begin
474 alc:= 1881.22 * fig * (org - fig) / (1.775 - org);
475 sug:= 3550 * fig * (0.1808 * org + 0.8192 * fig - 1.0004);
476 FCalories.Value:= (alc + sug) / (12 * 0.0295735296);
477 end
478 else FCalories.Value:= 0;
479 end;
480
481
482
483
484 */
485
486 ?> 292 ?>

mercurial