49 */ |
49 */ |
50 double Utils::ebc_to_srm(double ebc) |
50 double Utils::ebc_to_srm(double ebc) |
51 { |
51 { |
52 double srm = -0.00000000000132303 * pow(ebc, 4) - 0.00000000291515 * pow(ebc, 3) + 0.00000818515 * pow(ebc, 2) + 0.372038 * ebc + 0.596351; |
52 double srm = -0.00000000000132303 * pow(ebc, 4) - 0.00000000291515 * pow(ebc, 3) + 0.00000818515 * pow(ebc, 2) + 0.372038 * ebc + 0.596351; |
53 if (ebc < 0 || srm < 0) |
53 if (ebc < 0 || srm < 0) |
54 qDebug() << "ebc_to_srm(" << ebc << ") =" << srm; |
54 return 0; |
55 return srm; |
55 return srm; |
56 } |
56 } |
57 |
57 |
58 |
58 |
59 double Utils::srm_to_ebc(double srm) |
59 double Utils::srm_to_ebc(double srm) |
60 { |
60 { |
61 double ebc = round( 0.000000000176506 * pow(srm, 4) + 0.000000154529 * pow(srm, 3) - 0.000159428 * pow(srm, 2) + 2.68837 * srm - 1.6004 ); |
61 double ebc = round( 0.000000000176506 * pow(srm, 4) + 0.000000154529 * pow(srm, 3) - 0.000159428 * pow(srm, 2) + 2.68837 * srm - 1.6004 ); |
62 if ((ebc < 0) || (srm < 0)) |
62 if ((ebc < 0) || (srm < 0)) |
63 qDebug() << "srm_to_ebc(" << srm << ") =" << ebc; |
63 return 0; |
64 return ebc; |
64 return ebc; |
65 } |
65 } |
66 |
66 |
67 |
67 |
68 QString Utils::hours_to_string(int hours) |
68 QString Utils::hours_to_string(int hours) |