src/EditProductTab11.cpp

changeset 442
d8c110d91b1f
parent 439
31419b7cee69
child 443
3c195eb4e7a1
equal deleted inserted replaced
441:a7151cbe50fb 442:d8c110d91b1f
42 double P = -1.09145427669121 + 0.00800006989646477 * T + 0.000260276315484684 * T * T + 0.0215142075945119 * T * CO2 + 42 double P = -1.09145427669121 + 0.00800006989646477 * T + 0.000260276315484684 * T * T + 0.0215142075945119 * T * CO2 +
43 0.674996600795854 * CO2 + -0.00471757220150754 * CO2 * CO2; 43 0.674996600795854 * CO2 + -0.00471757220150754 * CO2 * CO2;
44 44
45 P = round((P * 1.01325) * 100.0) / 100.0; // atm to bar 45 P = round((P * 1.01325) * 100.0) / 100.0; // atm to bar
46 qDebug() << " GetPressure(" << CO2 << "," << T << ") CO2:" << CO2 << "Bar:" << P; 46 qDebug() << " GetPressure(" << CO2 << "," << T << ") CO2:" << CO2 << "Bar:" << P;
47 return P;
48 }
49
50
51 /*
52 * Calculate pressure in the bottles after refermentation.
53 * @param gl Sugar in gram/liter
54 * @param T Temperature in celsius
55 * @return Pressure in Bar.
56 */
57 double EditProduct::GetPressureBar(double gl, double T)
58 {
59 if (gl <= 0)
60 return 0;
61
62 double P = ((gl / 10.0) / exp(-10.73797 + (2617.25 / (T + 273.15)))) - 1.013;
63 if (P < 0)
64 P = 0;
65
66 P = round(P * 100.0) / 100.0;
67 qDebug() << " GetPressureBar(" << gl << "," << T << ") P:" << P;
68 return P; 47 return P;
69 } 48 }
70 49
71 50
72 double EditProduct::CarbCO2ToPressure(double CO2, double T) 51 double EditProduct::CarbCO2ToPressure(double CO2, double T)
176 double pabv = product->final_abv + (product->bottle_priming_amount * (1 / SFactor) * 0.47) / 7.907; 155 double pabv = product->final_abv + (product->bottle_priming_amount * (1 / SFactor) * 0.47) / 7.907;
177 double pvol = product->bottle_amount - (pabv * product->bottle_amount) / 100; 156 double pvol = product->bottle_amount - (pabv * product->bottle_amount) / 100;
178 talc = product->bottle_amount - pvol; 157 talc = product->bottle_amount - pvol;
179 tvol = pvol + product->bottle_priming_water; 158 tvol = pvol + product->bottle_priming_water;
180 product->bottle_abv = talc / (tvol + talc) * 100; 159 product->bottle_abv = talc / (tvol + talc) * 100;
181 product->bottle_bar = GetPressureBar(product->bottle_priming_amount, product->bottle_carbonation_temp); 160 product->bottle_bar = Utils::GetPressureBar(product->bottle_priming_amount, product->bottle_carbonation_temp);
182 ui->bottle_abvShow->setValue(product->bottle_abv); 161 ui->bottle_abvShow->setValue(product->bottle_abv);
183 ui->bottle_barShow->setValue(product->bottle_bar); 162 ui->bottle_barShow->setValue(product->bottle_bar);
184 } 163 }
185 } 164 }
186 } 165 }

mercurial