Sun, 11 Nov 2018 16:36:38 +0100
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
11 | 1 | <?php |
2 | ||
83
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
3 | define('EURO', chr(128)); |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
4 | |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
5 | define('MMCa', '40.048'); |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
6 | define('MMMg', '24.305'); |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
7 | define('MMNa', '22.98976928'); |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
8 | define('MMCl', '35.453'); |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
9 | define('MMSO4', '96.0626'); |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
10 | define('MMCO3', '60.01684'); |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
11 | define('MMHCO3', '61.01684'); |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
12 | define('MMCaSO4', '172.171'); |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
13 | define('MMCaCl2', '147.015'); |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
14 | define('MMCaCO3', '100.087'); |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
15 | define('MMMgSO4', '246.475'); |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
16 | define('MMNaHCO3', '84.007'); |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
17 | define('MMNa2CO3', '105.996'); |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
18 | define('MMNaCl', '58.443'); |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
19 | define('MMCaOH2', '74.06268'); |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
20 | |
11 | 21 | |
22 | function ebc_to_srm($ebc) | |
23 | { | |
24 | // Srm = -1.32303E-12*Ebc4-0.00000000291515*Ebc3+0.00000818515*Ebc2+0.372038*Ebc+0.596351 | |
25 | return -1.32303E-12 * pow($ebc, 4) - 0.00000000291515 * pow($ebc, 3) + 0.00000818515 * pow($ebc, 2) + 0.372038 * $ebc + 0.596351; | |
26 | // return $ebc * 0.508; | |
27 | } | |
28 | ||
29 | ||
83
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
30 | |
11 | 31 | function srm_to_ebc($srm) |
32 | { | |
33 | // EBC = 0.000000000176506*Srm4+ 0.000000154529*Srm3-0.000159428*Srm2+2.68837*Srm-1.6004 | |
34 | // | |
35 | // Formule van Adrie Otten. brouwhulp. | |
36 | $ebc = 0.000000000176506 * pow($srm, 4) + 0.000000154529 * pow($srm, 3) - 0.000159428 * pow($srm, 2) + 2.68837 * $srm - 1.6004; | |
37 | return round($ebc); | |
38 | } | |
39 | ||
40 | ||
83
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
41 | |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
42 | function ebc_to_color($ebc) |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
43 | { |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
44 | return srm_to_color(ebc_to_srm($ebc)); |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
45 | } |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
46 | |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
47 | |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
48 | |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
49 | function srm_to_color($srm) |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
50 | { |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
51 | $i = abs($srm * 10); |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
52 | if ($i < 0) { |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
53 | $i = 0; |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
54 | } |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
55 | if ($i > 299) { |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
56 | $i = 299; |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
57 | } |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
58 | |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
59 | /* Table copied from Brouwhulp/BrewBuddy */ |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
60 | $R = array( 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, // 0 |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
61 | 250, 250, 250, 250, 250, 249, 248, 247, 246, 245, 244, 243, 242, 241, 240, 239, 238, 237, 236, 235, // 2 |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
62 | 234, 233, 232, 231, 230, 229, 228, 227, 226, 225, 224, 223, 222, 221, 220, 219, 218, 217, 216, 215, // 4 |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
63 | 214, 213, 212, 211, 210, 209, 208, 207, 206, 205, 204, 203, 202, 201, 200, 200, 199, 199, 198, 198, // 6 |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
64 | 197, 197, 196, 196, 195, 195, 194, 194, 193, 193, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, // 8 |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
65 | 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, // 10 |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
66 | 192, 192, 192, 192, 192, 192, 192, 192, 191, 190, 189, 188, 187, 186, 185, 184, 183, 182, 181, 180, // 12 |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
67 | 179, 178, 177, 175, 174, 172, 171, 169, 168, 167, 195, 164, 162, 161, 159, 158, 157, 155, 154, 152, // 14 |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
68 | 151, 149, 148, 147, 145, 144, 142, 141, 139, 138, 137, 135, 134, 132, 131, 129, 128, 127, 125, 124, // 16 |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
69 | 122, 121, 119, 118, 117, 115, 114, 112, 111, 109, 108, 107, 105, 104, 102, 101, 99, 98, 97, 95, // 18 |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
70 | 94, 92, 91, 89, 88, 87, 85, 84, 82, 81, 79, 78, 77, 75, 74, 72, 71, 69, 68, 67, // 20 |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
71 | 65, 64, 62, 61, 59, 58, 57, 55, 54, 52, 51, 49, 48, 47, 45, 44, 43, 41, 39, 38, // 22 |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
72 | 37, 37, 36, 36, 35, 35, 34, 34, 33, 33, 32, 32, 31, 31, 30, 30, 29, 29, 28, 28, // 24 |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
73 | 27, 27, 26, 26, 25, 25, 24, 24, 23, 23, 22, 22, 21, 21, 20, 20, 19, 19, 18, 18, // 26 |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
74 | 17, 17, 16, 16, 15, 15, 14, 14, 13, 13, 12, 12, 11, 11, 10, 10, 9, 9, 8, 8 ); |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
75 | |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
76 | $G = array( 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
77 | 250, 250, 250, 250, 250, 250, 249, 248, 247, 246, 245, 244, 242, 240, 238, 236, 234, 232, 230, 228, |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
78 | 226, 224, 222, 220, 218, 216, 214, 212, 210, 208, 206, 204, 202, 200, 198, 196, 194, 192, 190, 188, |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
79 | 186, 184, 182, 180, 178, 176, 174, 172, 170, 168, 166, 164, 162, 160, 158, 156, 154, 152, 150, 148, |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
80 | 146, 144, 142, 141, 140, 139, 139, 138, 137, 136, 136, 135, 134, 133, 133, 132, 131, 130, 130, 129, |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
81 | 128, 127, 127, 126, 125, 124, 124, 123, 122, 121, 121, 120, 119, 118, 118, 117, 116, 115, 115, 114, |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
82 | 113, 112, 112, 111, 110, 109, 109, 108, 107, 106, 106, 105, 104, 103, 103, 102, 101, 100, 100, 99, |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
83 | 98, 97, 97, 96, 95, 94, 94, 93, 92, 91, 91, 90, 89, 88, 88, 87, 86, 85, 85, 84, |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
84 | 83, 82, 82, 81, 80, 79, 78, 77, 76, 75, 75, 74, 73, 72, 72, 71, 70, 69, 69, 68, |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
85 | 67, 66, 66, 65, 64, 63, 63, 62, 61, 60, 60, 59, 58, 57, 57, 56, 55, 54, 54, 53, |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
86 | 52, 51, 51, 50, 49, 48, 48, 47, 46, 45, 45, 44, 43, 42, 42, 41, 40, 39, 39, 38, |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
87 | 37, 36, 36, 35, 34, 33, 33, 32, 31, 30, 30, 29, 28, 27, 27, 26, 25, 24, 24, 23, |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
88 | 22, 22, 22, 21, 21, 21, 20, 20, 20, 19, 19, 19, 18, 18, 18, 17, 17, 17, 16, 16, |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
89 | 16, 15, 15, 15, 14, 14, 14, 13, 13, 13, 12, 12, 12, 11, 11, 11, 10, 10, 10, 9, |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
90 | 9, 9, 8, 8, 8, 7, 7, 7, 6, 6, 6, 5, 5, 5, 4, 4, 4, 3, 3, 3 ); |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
91 | |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
92 | $B = array( 210, 204, 199, 193, 188, 182, 177, 171, 166, 160, 155, 149, 144, 138, 133, 127, 122, 116, 111, 105, |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
93 | 100, 94, 89, 83, 78, 72, 67, 61, 56, 50, 45, 45, 45, 46, 46, 46, 46, 47, 47, 47, |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
94 | 47, 48, 48, 48, 48, 49, 49, 49, 49, 50, 50, 50, 50, 51, 51, 51, 51, 52, 52, 52, |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
95 | 52, 53, 53, 53, 53, 54, 54, 54, 54, 55, 55, 55, 55, 56, 56, 56, 56, 56, 56, 56, |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
96 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
97 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
98 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
99 | 56, 56, 56, 55, 55, 55, 55, 54, 54, 54, 54, 53, 53, 53, 53, 52, 52, 52, 52, 51, |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
100 | 51, 51, 51, 50, 50, 50, 50, 49, 49, 48, 47, 47, 46, 45, 45, 44, 43, 43, 42, 41, |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
101 | 41, 40, 39, 39, 38, 37, 37, 36, 35, 34, 33, 32, 31, 29, 28, 27, 26, 25, 24, 23, |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
102 | 21, 20, 19, 18, 17, 16, 15, 13, 12, 11, 10, 9, 8, 9, 9, 10, 10, 11, 11, 12, |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
103 | 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
104 | 21, 21, 21, 20, 20, 20, 19, 19, 19, 18, 18, 18, 17, 17, 17, 17, 16, 16, 15, 15, |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
105 | 15, 14, 14, 14, 13, 13, 13, 12, 12, 12, 11, 11, 11, 10, 10, 10, 9, 9, 9, 8, |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
106 | 8, 8, 7, 7, 7, 6, 6, 6, 5, 5, 5, 4, 4, 4, 3, 3, 3, 2, 2, 2 ); |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
107 | |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
108 | return array($R[$i],$G[$i],$B[$i]); |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
109 | } |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
110 | |
85521c6e0022
Added recipe print yeasts section.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
111 | |
85
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
112 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
113 | function sg_to_plato($sg) { |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
114 | if ($sg > 0.5) |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
115 | return 259 - 259 / $sg; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
116 | return 0; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
117 | } |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
118 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
119 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
120 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
121 | function plato_to_sg($plato) { |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
122 | if ($plato < 259) |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
123 | return 259 / (259 - $plato); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
124 | return 1.000; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
125 | } |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
126 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
127 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
128 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
129 | /* |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
130 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
131 | Brouwhulp data.pas |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
132 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
133 | Function THop.FlavourContribution : double; //in % * concentration in g/l |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
134 | var bt, vol : double; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
135 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
136 | bt:= FTime.Value; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
137 | vol:= 0; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
138 | if FRecipe <> NIL then vol:= FRecipe.BatchSize.Value; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
139 | if FUse = huFirstWort then Result:= 0.15 * FAmount.Value * 1000 //assume 15% flavourcontribution for fwh |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
140 | else if bt > 50 then Result:= 0.10 * FAmount.Value * 1000 //assume 10% flavourcontribution as a minimum |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
141 | else |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
142 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
143 | Result:= 15.25 / (6 * sqrt(2 * PI)) * Exp(-0.5*Power((bt-21)/6, 2)) |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
144 | * FAmount.Value * 1000; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
145 | if result < 0.10 * FAmount.Value * 1000 then |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
146 | Result:= 0.10 * FAmount.Value * 1000 //assume 10% flavourcontribution as a minimum |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
147 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
148 | if vol > 0 then Result:= Result / vol; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
149 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
150 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
151 | Function THop.AromaContribution : double; //in % * concentration in g/l |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
152 | var bt, vol : double; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
153 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
154 | bt:= FTime.Value; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
155 | vol:= 0; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
156 | if FRecipe <> NIL then vol:= FRecipe.BatchSize.Value; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
157 | if bt > 20 then Result:= 0 |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
158 | else if bt > 7.5 then |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
159 | Result:= 10.03 / (4 * sqrt(2 * PI)) * Exp(-0.5*Power((bt-7.5)/4, 2)) |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
160 | * FAmount.Value * 1000 |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
161 | else if FUse = huBoil then Result:= FAmount.Value * 1000 |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
162 | else if FUse = huAroma then Result:= 1.2 * FAmount.Value * 1000 |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
163 | else if FUse = huWhirlpool then Result:= 1.2 * FAmount.Value * 1000 |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
164 | else if FUse = huDryHop then Result:= 1.33 * FAmount.Value * 1000; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
165 | if vol > 0 then Result:= Result / vol; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
166 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
167 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
168 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
169 | Procedure TFermentable.SetpHParameters(force : boolean); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
170 | var x, ebc : double; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
171 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
172 | if Between(FDIpH.Value, -0.01, 0.01) or Between(FAcidTo57.Value, -0.1, 0.1) or force then |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
173 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
174 | ebc:= SRMtoEBC(FColor.Value); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
175 | case FGrainType of |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
176 | gtBase, gtKilned: |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
177 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
178 | FDIpH.Value:= -0.0132 * ebc + 5.7605; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
179 | x:= 0.4278 * ebc - 1.8106; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
180 | FAcidTo57.Value:= x; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
181 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
182 | gtRoast: |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
183 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
184 | FDIpH.Value:= 0.00018 * ebc + 4.558; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
185 | FAcidTo57.Value:= -0.0176 * ebc + 60.04; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
186 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
187 | gtCrystal: |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
188 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
189 | FDIpH.Value:= -0.0019 * ebc + 5.2175; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
190 | FAcidTo57.Value:= 0.132 * ebc + 14.277; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
191 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
192 | gtSour: |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
193 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
194 | FDIpH.Value:= 3.44; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
195 | FAcidTo57.Value:= 337; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
196 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
197 | gtSpecial: //this could be anything. Assume for now it is a non-acidulated base or kilned malt |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
198 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
199 | FDIpH.Value:= -0.0132 * ebc + 5.7605; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
200 | FAcidTo57.Value:= 0.4278 * ebc - 1.8106; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
201 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
202 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
203 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
204 | //known parameters should be filled in here |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
205 | if FSupplier.Value = 'Weyermann' then |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
206 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
207 | if FName.Value = 'Vienna mout' then |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
208 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
209 | FDIpH.Value:= 5.65; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
210 | FAcidTo57.Value:= 1.6; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
211 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
212 | if FName.Value = 'Münchner I' then |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
213 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
214 | FDIpH.Value:= 5.44; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
215 | FAcidTo57.Value:= 8.4; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
216 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
217 | if FName.Value = 'Münchner II' then |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
218 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
219 | FDIpH.Value:= 5.54; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
220 | FAcidTo57.Value:= 5.6; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
221 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
222 | if FName.Value = 'Caramunich I' then |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
223 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
224 | FDIpH.Value:= 5.1; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
225 | FAcidTo57.Value:= 22.4; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
226 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
227 | if FName.Value = 'Caramunich II' then |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
228 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
229 | FDIpH.Value:= 4.71; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
230 | FAcidTo57.Value:= 49; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
231 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
232 | if FName.Value = 'Caramunich III' then |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
233 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
234 | FDIpH.Value:= 4.92; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
235 | FAcidTo57.Value:= 31.2; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
236 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
237 | if FName.Value = 'Cara-aroma' then |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
238 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
239 | FDIpH.Value:= 4.48; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
240 | FAcidTo57.Value:= 74.4; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
241 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
242 | if FName.Value = 'Carafa I' then |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
243 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
244 | FDIpH.Value:= 4.71; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
245 | FAcidTo57.Value:= 42; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
246 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
247 | if FName.Value = 'Carafa III' then |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
248 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
249 | FDIpH.Value:= 4.81; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
250 | FAcidTo57.Value:= 35.4; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
251 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
252 | if FName.Value = 'Carafa II' then |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
253 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
254 | FDIpH.Value:= 4.76; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
255 | FAcidTo57.Value:= 38.7; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
256 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
257 | if FName.Value = 'Carafa Special I' then |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
258 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
259 | FDIpH.Value:= 4.73; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
260 | FAcidTo57.Value:= 46.4; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
261 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
262 | if FName.Value = 'Carafa Special II' then |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
263 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
264 | FDIpH.Value:= 4.78; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
265 | FAcidTo57.Value:= 42.9; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
266 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
267 | if FName.Value = 'Carafa Special III' then |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
268 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
269 | FDIpH.Value:= 4.83; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
270 | FAcidTo57.Value:= 38.9; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
271 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
272 | if IsInString(FName.Value, 'Zuurmout') then |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
273 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
274 | FDIpH.Value:= 3.44; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
275 | FAcidTo57.Value:= 358.2; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
276 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
277 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
278 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
279 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
280 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
281 | function TFermentable.GetExtract: double; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
282 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
283 | Result := 0; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
284 | if FRecipe <> nil then |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
285 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
286 | Result := FAmount.Value * FYield.Value / 100 * (1 - FMoisture.Value / 100); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
287 | if FAdded = atMash then |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
288 | Result := Result * FRecipe.Efficiency / 100; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
289 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
290 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
291 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
292 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
293 | function TFermentable.GetKolbachIndex: double; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
294 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
295 | if FProtein.Value > 0 then |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
296 | Result := FDissolvedProtein.Value / FProtein.Value |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
297 | else |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
298 | Result := 0; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
299 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
300 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
301 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
302 | Procedure TWater.AddMinerals(Ca, Mg, Na, HCO3, Cl, SO4 : double); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
303 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
304 | FCalcium.Add(Ca); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
305 | FMagnesium.Add(Mg); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
306 | FSodium.Add(Na); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
307 | FBicarbonate.Add(HCO3); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
308 | FChloride.Add(Cl); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
309 | FSulfate.Add(SO4); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
310 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
311 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
312 | function TWater.GetResidualAlkalinity: double; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
313 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
314 | //Result in mg/l as CaCO3 |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
315 | Result:= FTotalAlkalinity.Value - (FCalcium.Value / 1.4 + FMagnesium.Value / 1.7); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
316 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
317 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
318 | const |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
319 | Ka1 = 0.0000004445; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
320 | Ka2 = 0.0000000000468; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
321 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
322 | Function PartCO3(pH : double) : double; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
323 | var H : double; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
324 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
325 | H:= Power(10, -pH); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
326 | Result:= 100 * Ka1 * Ka2 / (H*H + H * Ka1 + Ka1 * Ka2); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
327 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
328 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
329 | Function PartHCO3(pH : double) : double; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
330 | var H : double; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
331 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
332 | H:= Power(10, -pH); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
333 | Result:= 100 * Ka1 * H / (H*H + H * Ka1 + Ka1 * Ka2); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
334 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
335 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
336 | Function PartH2CO3(pH : double) : double; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
337 | var H : double; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
338 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
339 | H:= Power(10, -pH); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
340 | Result:= 100 * H * H / (H*H + H * Ka1 + Ka1 * Ka2); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
341 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
342 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
343 | Function Charge(pH : double) : double; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
344 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
345 | Result:= (-2 * PartCO3(pH) - PartHCO3(pH)); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
346 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
347 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
348 | //Z alkalinity is the amount of acid (in mEq/l) needed to bring water to the target pH (Z pH) |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
349 | Function TWater.ZAlkalinity(pHZ : double) : double; //in mEq/l |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
350 | var CT, DeltaCNaught, DeltaCZ, C43, Cw, Cz : double; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
351 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
352 | C43:= Charge(4.3); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
353 | Cw:= Charge(FpH.Value); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
354 | Cz:= Charge(pHz); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
355 | DeltaCNaught:= -C43+Cw; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
356 | CT:= GetAlkalinity / 50 / DeltaCNaught; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
357 | DeltaCZ:= -Cz+Cw; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
358 | Result:= CT * DeltaCZ; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
359 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
360 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
361 | //Z Residual alkalinity is the amount of acid (in mEq/l) needed to bring the water in the mash to the target pH (Z pH) |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
362 | Function TWater.ZRA(pHZ : double) : double; //in mEq/l |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
363 | var Calc, Magn, Z : double; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
364 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
365 | Calc:= FCalcium.Value / (MMCa / 2); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
366 | Magn:= FMagnesium.Value / (MMMg / 2); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
367 | Z:= ZAlkalinity(pHZ); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
368 | Result:= Z - (Calc / 3.5 + Magn / 7); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
369 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
370 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
371 | Function TWater.ProtonDeficit(pHZ : double) : double; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
372 | var i : integer; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
373 | F : TFermentable; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
374 | x : double; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
375 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
376 | Result:= ZRA(pHZ) * FAmount.Value; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
377 | //proton deficit for the added malts |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
378 | for i:= 0 to FRecipe.NumFermentables - 1 do |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
379 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
380 | F:= FRecipe.Fermentable[i]; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
381 | if (F.AddedType = atMash) and (F.GrainType <> gtNone) then |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
382 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
383 | x:= F.AcidRequired(pHZ) * F.Amount.Value; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
384 | Result:= Result + x; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
385 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
386 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
387 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
388 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
389 | Function TWater.MashpH : double; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
390 | var n : integer; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
391 | pd : double; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
392 | pH, deltapH, deltapd : double; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
393 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
394 | Result:= 0; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
395 | n:= 0; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
396 | pH:= 5.4; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
397 | deltapH:= 0.001; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
398 | deltapd:= 0.1; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
399 | pd:= ProtonDeficit(pH); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
400 | while ((pd < -deltapd) or (pd > deltapd)) and (n < 1000) do |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
401 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
402 | inc(n); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
403 | if pd < -deltapd then ph:= ph - deltapH |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
404 | else if pd > deltapd then pH:= pH + deltapH; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
405 | pd:= ProtonDeficit(pH); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
406 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
407 | Result:= pH; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
408 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
409 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
410 | Function TWater.MashpH2(PrDef : double) : double; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
411 | var n : integer; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
412 | pd : double; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
413 | pH, deltapH, deltapd : double; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
414 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
415 | Result:= 0; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
416 | n:= 0; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
417 | pH:= 5.4; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
418 | deltapH:= 0.001; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
419 | deltapd:= 0.1; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
420 | pd:= ProtonDeficit(pH); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
421 | while ((pd < PrDef-deltapd) or (pd > PrDef + deltapd)) and (n < 1000) do |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
422 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
423 | inc(n); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
424 | if pd < PrDef-deltapd then ph:= ph - deltapH |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
425 | else if pd > PrDef+deltapd then pH:= pH + deltapH; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
426 | pd:= ProtonDeficit(pH); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
427 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
428 | Result:= pH; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
429 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
430 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
431 | function TWater.GetAlkalinity: double; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
432 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
433 | Result := FBicarbonate.Value / 1.22; //mEq/l |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
434 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
435 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
436 | function TWater.GetHardness: double; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
437 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
438 | Result := 0.14 * FCalcium.Value - 0.23 * FMagnesium.Value; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
439 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
440 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
441 | function TWater.GetEstPhMash: double; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
442 | {var |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
443 | pHdemi, S: double;} |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
444 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
445 | Result:= MashpH; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
446 | { Result := 0; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
447 | if FRecipe <> nil then |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
448 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
449 | pHDemi := FRecipe.pHdemi; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
450 | S := 0.013 * FRecipe.MashThickness + 0.013; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
451 | Result := pHDemi + ResidualAlkalinity / 50 * S; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
452 | end;} |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
453 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
454 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
455 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
456 | function TBeerStyle.GetBUGUMin: double; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
457 | var |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
458 | B, G: double; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
459 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
460 | Result:= 0; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
461 | if ((FOGMax.Value + FOGMin.Value) > 0) and ((FIBUMax.Value + FIBUMin.Value) > 0) then |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
462 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
463 | G := (FOGMax.Value - FOGMin.Value) / ((FOGMax.Value + FOGMin.Value) / 2); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
464 | B := (FIBUMax.Value - FIBUMin.Value) / ((FIBUMax.Value + FIBUMin.Value) / 2); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
465 | if G > B then |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
466 | Result := ((FIBUMin.Value + FIBUMax.Value) / 2) / (1000 * (FOGMax.Value - 1)) |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
467 | else |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
468 | Result := FIBUMin.Value / (1000 * (((FOGMax.Value + FOGMin.Value) / 2) - 1)); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
469 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
470 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
471 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
472 | function TBeerStyle.GetBUGUMax: double; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
473 | var |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
474 | B, G: double; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
475 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
476 | Result:= 0; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
477 | if ((FOGMax.Value + FOGMin.Value) > 0) and ((FIBUMax.Value + FIBUMin.Value) > 0) |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
478 | and (FOGMin.Value > 1) then |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
479 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
480 | G := (FOGMax.Value - FOGMin.Value) / ((FOGMax.Value + FOGMin.Value) / 2); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
481 | B := (FIBUMax.Value - FIBUMin.Value) / ((FIBUMax.Value + FIBUMin.Value) / 2); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
482 | if G > B then |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
483 | Result := ((FIBUMin.Value + FIBUMax.Value) / 2) / (1000 * (FOGMin.Value - 1)) |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
484 | else |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
485 | Result := FIBUMax.Value / (1000 * (((FOGMax.Value + FOGMin.Value) / 2) - 1)); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
486 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
487 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
488 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
489 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
490 | CalcOG; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
491 | CalcBitterness; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
492 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
493 | // Get concentration of ions in diluted brewwater (1) and target water (2) in mmol/l |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
494 | Ca1 := W.Calcium.Value / MMCa; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
495 | Ca2 := W2.Calcium.Value / MMCa; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
496 | Mg1 := W.Magnesium.Value / MMMg; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
497 | Mg2 := W2.Magnesium.Value / MMMg; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
498 | Na1 := W.Sodium.Value / MMNa; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
499 | Na2 := W2.Sodium.Value / MMNa; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
500 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
501 | CO31 := W.Bicarbonate.Value / MMHCO3; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
502 | CO32 := W2.Bicarbonate.Value / MMHCO3; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
503 | SO41 := W.Sulfate.Value / MMSO4; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
504 | SO42 := W2.Sulfate.Value / MMSO4; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
505 | Cl1 := W.Sulfate.Value / MMSO4; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
506 | Cl2 := W2.Sulfate.Value / MMSO4; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
507 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
508 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
509 | procedure MixWater(W1, W2, Wr: TWater); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
510 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
511 | function Mix(V1, V2, C1, C2: double): double; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
512 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
513 | if (V1 + V2) > 0 then |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
514 | Result := (V1 * C1 + V2 * C2) / (V1 + V2) |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
515 | else |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
516 | Result := 0; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
517 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
518 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
519 | var |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
520 | vol1, vol2: double; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
521 | phnew: double; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
522 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
523 | vol1 := W1.Amount.Value; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
524 | vol2 := W2.Amount.Value; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
525 | if (vol1 + vol2) > 0 then |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
526 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
527 | Wr.Amount.Value := vol1 + vol2; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
528 | Wr.Calcium.Value := Mix(vol1, vol2, W1.Calcium.Value, W2.Calcium.Value); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
529 | Wr.Magnesium.Value := Mix(vol1, vol2, W1.Magnesium.Value, W2.Magnesium.Value); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
530 | Wr.Sodium.Value := Mix(vol1, vol2, W1.Sodium.Value, W2.Sodium.Value); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
531 | Wr.Bicarbonate.Value := Mix(vol1, vol2, W1.Bicarbonate.Value, W2.Bicarbonate.Value); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
532 | Wr.Sulfate.Value := Mix(vol1, vol2, W1.Sulfate.Value, W2.Sulfate.Value); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
533 | Wr.Chloride.Value := Mix(vol1, vol2, W1.Chloride.Value, W2.Chloride.Value); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
534 | pHnew := -log10((power(10, -W1.pHWater.Value) * vol1 + |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
535 | power(10, -W2.pHWater.Value) * vol2) / (vol1 + vol2)); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
536 | Wr.pHwater.Value := pHnew; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
537 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
538 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
539 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
540 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
541 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
542 | function TRecipe.CalcColorWort : double; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
543 | var |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
544 | i: integer; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
545 | F: TFermentable; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
546 | c, v: double; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
547 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
548 | c := 0; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
549 | v := FBatchSize.Value; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
550 | if (v > 0) and (High(FFermentables) >= 0) then |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
551 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
552 | for i := Low(FFermentables) to High(FFermentables) do |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
553 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
554 | F := TFermentable(FFermentables[i]); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
555 | c := c + F.Amount.Value * F.Color.Value / v; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
556 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
557 | c := c * 8.34436; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
558 | case FColorMethod of |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
559 | cmMorey: c := 1.49 * Power(c, 0.69); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
560 | cmMosher: c := 0.3 * c + 4.7; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
561 | cmDaniels: c := 0.2 * c + 8.4; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
562 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
563 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
564 | Result:= c; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
565 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
566 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
567 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
568 | procedure TRecipe.CalcWaterBalance; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
569 | var |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
570 | i: integer; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
571 | F: TFermentable; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
572 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
573 | FAbsorbedByGrain := 0; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
574 | for i := Low(FFermentables) to High(FFermentables) do |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
575 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
576 | F := TFermentable(FFermentables[i]); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
577 | if (F.FermentableType = ftGrain) or (F.FermentableType = ftAdjunct) then |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
578 | FAbsorbedByGrain := FAbsorbedByGrain + F.Amount.Value; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
579 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
580 | FAbsorbedByGrain := FAbsorbedByGrain * Settings.GrainAbsorption.Value; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
581 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
582 | if FEquipment.CalcBoilVolume.Value then |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
583 | {FBoilSize.Value := FBatchSize.Value / (1 - (FEquipment.EvapRate.Value / 100) * |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
584 | (FBoilTime.Value / 60));} |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
585 | FBoilSize.Value:= FBatchSize.Value + FEquipment.BoilSize.Value |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
586 | * FEquipment.EvapRate.Value / 100 * |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
587 | (FBoilTime.Value / 60); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
588 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
589 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
590 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
591 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
592 | procedure TRecipe.CalcOG; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
593 | var |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
594 | i, j, k: integer; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
595 | v, v2, sg, d, tot, tot2, vol, vol1, vol2, sugF, sug, sug2, p, x: double; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
596 | mass1, mass2 : double; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
597 | F: TFermentable; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
598 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
599 | for j := 1 to 1 do |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
600 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
601 | sug:= 0; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
602 | sugf:= 0; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
603 | sug2:= 0; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
604 | tot := 0; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
605 | tot2:= 0; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
606 | vol:= 0; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
607 | FEfficiency.Value := GetEfficiency; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
608 | for i := 0 to NumFermentables - 1 do |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
609 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
610 | F := TFermentable(Fermentable[i]); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
611 | if (F.AddedType = atMash) or (F.AddedType = atBoil) then |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
612 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
613 | d := F.Amount.Value * (F.Yield.Value / 100) * (1 - F.Moisture.Value / 100); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
614 | if (F.AddedType = atMash) then |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
615 | d := FEfficiency.Value / 100 * d; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
616 | sugf := sugf + d; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
617 | tot := tot + F.Amount.Value; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
618 | end |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
619 | else |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
620 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
621 | x:= (F.Yield.Value / 100) * (1 - F.Moisture.Value / 100); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
622 | sug2:= sug2 + F.Amount.Value * x; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
623 | tot2:= tot2 + F.Amount.Value; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
624 | tot := tot + F.Amount.Value; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
625 | vol:= vol + F.Amount.Value / (x * SugarDensity + (1 - x) * 1); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
626 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
627 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
628 | if tot > 0 then |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
629 | for i := 0 to NumFermentables - 1 do |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
630 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
631 | F := Fermentable[i]; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
632 | F.Percentage.Value := 100 * F.Amount.Value / tot; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
633 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
634 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
635 | if (FEquipment <> NIL) and (FBatchSize.Value > 0) then |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
636 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
637 | vol1:= FBatchSize.Value - FEquipment.TrubChillerLoss.Value; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
638 | vol2:= vol1 + FEquipment.TopUpWater.Value + vol; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
639 | sug:= sugf * vol1 / FBatchSize.Value; //kg |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
640 | sug:= sug + sug2; //kg |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
641 | if vol2 > 0 then |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
642 | sug:= sug / vol2; //kg/l |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
643 | p:= 100 * sug; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
644 | sg:= PlatoToSG(p); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
645 | for k:= 1 to 30 do |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
646 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
647 | if sg > 0 then |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
648 | p := 100 * sug / sg; //deg. Plato |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
649 | sg := PlatoToSG(p); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
650 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
651 | FEstOG.Value:= sg; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
652 | end |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
653 | else if FBatchSize.Value <> 0 then |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
654 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
655 | p := 100 * sugf / FBatchSize.Value; //deg. Plato |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
656 | sg := PlatoToSG(p); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
657 | for k:= 1 to 20 do |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
658 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
659 | if sg > 0 then |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
660 | p := 100 * sugf / (FBatchSize.Value * sg); //deg. Plato |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
661 | sg := PlatoToSG(p); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
662 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
663 | FEstOG.Value := sg; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
664 | end |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
665 | else |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
666 | FEstOG.Value := 1.0; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
667 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
668 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
669 | CalcWaterBalance; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
670 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
671 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
672 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
673 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
674 | procedure TRecipe.EstimateFG; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
675 | var |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
676 | i: integer; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
677 | percS, percCara, BD, Att, AttBeer, sg: double; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
678 | Temp, TotTme: double; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
679 | Y: TYeast; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
680 | // Eq: TEquipment; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
681 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
682 | percS := GetPercSugar; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
683 | //if PercS > 40 then PercS:= 0; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
684 | percCara := GetPercCrystalMalt; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
685 | if percCara > 50 then PercCara:= 0; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
686 | if (Mash <> nil) and (Mash.MashStep[0] <> nil) then |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
687 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
688 | BD := Mash.MashStep[0].WaterToGrainRatio; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
689 | BD:= Max(2, Min(5.5, BD)); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
690 | Temp := Mash.AverageTemperature; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
691 | Temp:= Max(60, Min(72, Temp)); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
692 | TotTme := Mash.TotalMashTime; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
693 | TotTme:= Max(20, Min(90, TotTme)); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
694 | end |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
695 | else |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
696 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
697 | BD := 3.5; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
698 | Temp := 67; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
699 | TotTme := 75; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
700 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
701 | Y := Yeast[0]; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
702 | if Y <> nil then |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
703 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
704 | Att := Y.Attenuation.Value; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
705 | if Att < 30 then Att:= 77; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
706 | end |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
707 | else |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
708 | Att := 77; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
709 | AttBeer := 0.00825 * Att + 0.00817 * BD - 0.00684 * Temp + 0.00026 * |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
710 | TotTme - 0.00356 * PercCara + 0.00553 * PercS + 0.547; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
711 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
712 | { Eq := nil; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
713 | if FEquipment <> nil then |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
714 | Eq := TEquipment(Equipments.FindByName(FEquipment.Name.Value)); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
715 | if Eq <> nil then |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
716 | AttBeer2 := Eq.EstimateFG(Att, BD, Temp, TotTme, PercCara, PercS);} |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
717 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
718 | FEstFG.Value := 1 + (1 - AttBeer) * (FEstOG.Value - 1); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
719 | CalcOGFermenter; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
720 | if FOGFermenter.Value > 1.001 then |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
721 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
722 | sg:= FOGFermenter.Value; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
723 | FEstFG2.Value := 1 + (1 - AttBeer) * (sg - 1); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
724 | FEstABV.Value := ABVol(FEstOG.Value, FEstFG.Value); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
725 | end |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
726 | else if FOG.Value > 1.001 then |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
727 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
728 | sg:= FOG.Value; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
729 | FEstFG2.Value := 1 + (1 - AttBeer) * (sg - 1); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
730 | FEstABV.Value := ABVol(FEstOG.Value, FEstFG.Value); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
731 | end |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
732 | else |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
733 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
734 | FEstFG2.Value := 1 + (1 - AttBeer) * (FEstOG.Value - 1); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
735 | FEstABV.Value := ABVol(FEstOG.Value, FEstFG.Value); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
736 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
737 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
738 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
739 | Procedure TRecipe.CalcCalories; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
740 | var sug, alc, org, fig : double; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
741 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
742 | if FOGFermenter.Value > 1.001 then org:= FOGFermenter.Value |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
743 | else if FOG.Value > 1.001 then org:= FOG.Value |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
744 | else org:= 0; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
745 | if FFG.Value > 0.999 then fig:= FFG.Value |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
746 | else if FEstFG.Value > 1.000 then fig:= FEstFG.Value |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
747 | else if FEstFG2.Value > 1.000 then fig:= FEstFG2.Value |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
748 | else fig:= 0; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
749 | if (org > 0) and (fig > 0) then |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
750 | begin |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
751 | alc:= 1881.22 * fig * (org - fig) / (1.775 - org); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
752 | sug:= 3550 * fig * (0.1808 * org + 0.8192 * fig - 1.0004); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
753 | FCalories.Value:= (alc + sug) / (12 * 0.0295735296); |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
754 | end |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
755 | else FCalories.Value:= 0; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
756 | end; |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
757 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
758 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
759 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
760 | |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
761 | */ |
ca7a37586551
Added SG/Plato formulas for PHP. Added OG calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
762 | |
11 | 763 | ?> |