src/Utils.cpp

changeset 42
88e827ea7172
parent 29
76846c99f827
child 57
75d11cc05ce4
equal deleted inserted replaced
41:dc4b659a320b 42:88e827ea7172
14 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>. 15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 #include "Utils.h" 17 #include "Utils.h"
18 18
19 #include <QDebug>
19 #include <math.h> 20 #include <math.h>
20 21
21 22
22 double Utils::lintner_to_kolbach(double lintner) 23 double Utils::lintner_to_kolbach(double lintner)
23 { 24 {
31 double Utils::kolbach_to_lintner(double kolbach) 32 double Utils::kolbach_to_lintner(double kolbach)
32 { 33 {
33 return round(((kolbach + 16) / 3.5) * 1000.0) / 1000.0; 34 return round(((kolbach + 16) / 3.5) * 1000.0) / 1000.0;
34 } 35 }
35 36
37
38 double Utils::ebc_to_srm(double ebc)
39 {
40 double srm = -1.32303E-12 * pow(ebc, 4) - 0.00000000291515 * pow(ebc, 3) + 0.00000818515 * pow(ebc, 2) + 0.372038 * ebc + 0.596351;
41 if (ebc < 0 || srm < 0)
42 qDebug() << "ebc_to_srm(" << ebc << ") =" << srm;
43 return srm;
44 }
45
46
47 double Utils::srm_to_ebc(double srm)
48 {
49 // Formule van Adrie Otten. brouwhulp.
50 double ebc = round( 0.000000000176506 * pow(srm, 4) + 0.000000154529 * pow(srm, 3) - 0.000159428 * pow(srm, 2) + 2.68837 * srm - 1.6004 );
51 if ((ebc < 0) || (srm < 0))
52 qDebug() << "srm_to_ebc(" << srm << ") =" << ebc;
53 return ebc;
54 }
55
56
57

mercurial