19 define('MMCaOH2', '74.06268'); |
19 define('MMCaOH2', '74.06268'); |
20 |
20 |
21 |
21 |
22 function ebc_to_srm($ebc) |
22 function ebc_to_srm($ebc) |
23 { |
23 { |
24 // Srm = -1.32303E-12*Ebc4-0.00000000291515*Ebc3+0.00000818515*Ebc2+0.372038*Ebc+0.596351 |
24 $srm = -1.32303E-12 * pow($ebc, 4) - 0.00000000291515 * pow($ebc, 3) + 0.00000818515 * pow($ebc, 2) + 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; |
25 if (($ebc < 0) || ($srm < 0)) |
26 // return $ebc * 0.508; |
26 syslog(LOG_NOTICE, "ebc_to_srm(".$ebc.") = ".$srm); |
|
27 return $srm; |
27 } |
28 } |
28 |
29 |
29 |
30 |
30 |
31 |
31 function srm_to_ebc($srm) |
32 function srm_to_ebc($srm) |
32 { |
33 { |
33 // EBC = 0.000000000176506*Srm4+ 0.000000154529*Srm3-0.000159428*Srm2+2.68837*Srm-1.6004 |
|
34 // |
|
35 // Formule van Adrie Otten. brouwhulp. |
34 // 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; |
35 $ebc = round( 0.000000000176506 * pow($srm, 4) + 0.000000154529 * pow($srm, 3) - 0.000159428 * pow($srm, 2) + 2.68837 * $srm - 1.6004 ); |
37 return round($ebc); |
36 if (($ebc < 0) || ($srm < 0)) |
|
37 syslog(LOG_NOTICE, "srm_to_ebc(".$srm.") = ".$ebc); |
|
38 return $ebc; |
38 } |
39 } |
39 |
40 |
40 |
41 |
41 |
42 |
42 function ebc_to_color($ebc) |
43 function ebc_to_color($ebc) |