Sat, 10 Nov 2018 17:23:53 +0100
Added recipe print yeasts section.
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 | |
11 | 112 | ?> |