# HG changeset patch # User Michiel Broek # Date 1668770252 -3600 # Node ID d8c110d91b1f62cc67cabde4791de64f6c190488 # Parent a7151cbe50fbe90d5370661a8377c308adc0ed44 Moved GetPressureBar function to the Utils. diff -r a7151cbe50fb -r d8c110d91b1f src/EditProduct.h --- a/src/EditProduct.h Thu Nov 17 17:26:08 2022 +0100 +++ b/src/EditProduct.h Fri Nov 18 12:17:32 2022 +0100 @@ -335,7 +335,6 @@ double ResCO2(double T); double CarbCO2toS(double CO2, double T, double SFactor); double GetPressure(double CO2, double T); - double GetPressureBar(double gl, double T); double CarbCO2ToPressure(double CO2, double T); void calcPack(); void exportBeerXML(); diff -r a7151cbe50fb -r d8c110d91b1f src/EditProductTab11.cpp --- a/src/EditProductTab11.cpp Thu Nov 17 17:26:08 2022 +0100 +++ b/src/EditProductTab11.cpp Fri Nov 18 12:17:32 2022 +0100 @@ -48,27 +48,6 @@ } -/* - * Calculate pressure in the bottles after refermentation. - * @param gl Sugar in gram/liter - * @param T Temperature in celsius - * @return Pressure in Bar. - */ -double EditProduct::GetPressureBar(double gl, double T) -{ - if (gl <= 0) - return 0; - - double P = ((gl / 10.0) / exp(-10.73797 + (2617.25 / (T + 273.15)))) - 1.013; - if (P < 0) - P = 0; - - P = round(P * 100.0) / 100.0; - qDebug() << " GetPressureBar(" << gl << "," << T << ") P:" << P; - return P; -} - - double EditProduct::CarbCO2ToPressure(double CO2, double T) { return (CO2 - (-0.000005594056 * pow(T, 4) + 0.000144357886 * pow(T, 3) + @@ -178,7 +157,7 @@ talc = product->bottle_amount - pvol; tvol = pvol + product->bottle_priming_water; product->bottle_abv = talc / (tvol + talc) * 100; - product->bottle_bar = GetPressureBar(product->bottle_priming_amount, product->bottle_carbonation_temp); + product->bottle_bar = Utils::GetPressureBar(product->bottle_priming_amount, product->bottle_carbonation_temp); ui->bottle_abvShow->setValue(product->bottle_abv); ui->bottle_barShow->setValue(product->bottle_bar); } diff -r a7151cbe50fb -r d8c110d91b1f src/Utils.cpp --- a/src/Utils.cpp Thu Nov 17 17:26:08 2022 +0100 +++ b/src/Utils.cpp Fri Nov 18 12:17:32 2022 +0100 @@ -771,3 +771,17 @@ } +double Utils::GetPressureBar(double gl, double T) +{ + if (gl <= 0) + return 0; + + double P = ((gl / 10.0) / exp(-10.73797 + (2617.25 / (T + 273.15)))) - 1.013; + if (P < 0) + P = 0; + + P = round(P * 100.0) / 100.0; + qDebug() << " GetPressureBar(" << gl << "," << T << ") P:" << P; + return P; +} + diff -r a7151cbe50fb -r d8c110d91b1f src/Utils.h --- a/src/Utils.h Thu Nov 17 17:26:08 2022 +0100 +++ b/src/Utils.h Fri Nov 18 12:17:32 2022 +0100 @@ -195,6 +195,14 @@ double Charge(double pH); double CalcFrac(double TpH, double pK1, double pK2, double pK3); + + /** + * @brief Calculate pressure in Bar after refermentation. + * @param gl Sugar in gram/liter + * @param T Temperature in celsius + * @return Pressure in Bar. + */ + double GetPressureBar(double gl, double T); } #endif diff -r a7151cbe50fb -r d8c110d91b1f translations/bmsapp_en.ts --- a/translations/bmsapp_en.ts Thu Nov 17 17:26:08 2022 +0100 +++ b/translations/bmsapp_en.ts Fri Nov 18 12:17:32 2022 +0100 @@ -4774,12 +4774,12 @@ - + Confirm package - + Confirm that the beer is packaged and all data is correct diff -r a7151cbe50fb -r d8c110d91b1f translations/bmsapp_nl.ts --- a/translations/bmsapp_nl.ts Thu Nov 17 17:26:08 2022 +0100 +++ b/translations/bmsapp_nl.ts Fri Nov 18 12:17:32 2022 +0100 @@ -5440,12 +5440,12 @@ Batterij volt - + Confirm package Bevestig verpakken - + Confirm that the beer is packaged and all data is correct Bevestig dat het bier verpakt is en de gegevens kloppen