--- a/src/EditProductTab11.cpp Fri Nov 18 12:17:32 2022 +0100 +++ b/src/EditProductTab11.cpp Fri Nov 18 16:57:02 2022 +0100 @@ -17,22 +17,6 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -double EditProduct::ResCO2(double T) -{ - double F = T * 1.8 + 32; - return round((3.0378 - 0.050062 * F + 0.00026555 * F * F) * 1000000.0) / 1000000.0; -} - - -double EditProduct::CarbCO2toS(double CO2, double T, double SFactor) -{ - //var sugar = SFactor * (CO2 - ResCO2(CO2, T)) / 0.286; - double sugar = round((SFactor * (CO2 - ResCO2(T)) * 4.014094) * 1000000.0) / 1000000.0; - if (sugar < 0) - sugar = 0; - return sugar; //Round(sugar, 3); -} - double EditProduct::GetPressure(double CO2, double T) { @@ -139,8 +123,8 @@ product->fermentables.removeAt(i); // Remove false fermentable refreshFermentables(); } else { - product->bottle_priming_amount = CarbCO2toS(product->bottle_carbonation, TSec, SFactor); -// qDebug() << " priming CarbCO2toS(" << product->bottle_carbonation << TSec << SFactor << ") =" << product->bottle_priming_amount; + product->bottle_priming_amount = Utils::CarbCO2toS(product->bottle_carbonation, TSec, SFactor); + //qDebug() << " priming CarbCO2toS(" << product->bottle_carbonation << TSec << SFactor << ") =" << product->bottle_priming_amount; ui->bottle_sug_amountShow->setValue(product->bottle_priming_amount); double total = round(product->bottle_priming_amount * product->bottle_amount * 100.0) / 100000.0; if (total != product->fermentables.at(i).amount) { @@ -157,7 +141,7 @@ talc = product->bottle_amount - pvol; tvol = pvol + product->bottle_priming_water; product->bottle_abv = talc / (tvol + talc) * 100; - product->bottle_bar = Utils::GetPressureBar(product->bottle_priming_amount, product->bottle_carbonation_temp); + product->bottle_bar = Utils::GetPressureBar(product->bottle_priming_amount * (1 / SFactor), product->bottle_carbonation_temp); ui->bottle_abvShow->setValue(product->bottle_abv); ui->bottle_barShow->setValue(product->bottle_bar); } @@ -222,7 +206,7 @@ product->fermentables.removeAt(i); // Remove false fermentable refreshFermentables(); } else { - product->keg_priming_amount = CarbCO2toS(product->keg_carbonation, TSec, SFactor); + product->keg_priming_amount = Utils::CarbCO2toS(product->keg_carbonation, TSec, SFactor); ui->keg_sug_amountShow->setValue(product->keg_priming_amount); double total = round(product->keg_priming_amount * product->keg_amount * 100.0) / 100000.0; qDebug() << " total" << total << product->fermentables.at(i).amount;