Moved GetPressureBar function to the Utils.

Fri, 18 Nov 2022 12:17:32 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Fri, 18 Nov 2022 12:17:32 +0100
changeset 442
d8c110d91b1f
parent 441
a7151cbe50fb
child 443
3c195eb4e7a1

Moved GetPressureBar function to the Utils.

src/EditProduct.h file | annotate | diff | comparison | revisions
src/EditProductTab11.cpp file | annotate | diff | comparison | revisions
src/Utils.cpp file | annotate | diff | comparison | revisions
src/Utils.h file | annotate | diff | comparison | revisions
translations/bmsapp_en.ts file | annotate | diff | comparison | revisions
translations/bmsapp_nl.ts file | annotate | diff | comparison | revisions
--- 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();
--- 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);
 	    }
--- 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;
+}
+
--- 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
--- 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 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/EditProductTab11.cpp" line="317"/>
+        <location filename="../src/EditProductTab11.cpp" line="296"/>
         <source>Confirm package</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/EditProductTab11.cpp" line="317"/>
+        <location filename="../src/EditProductTab11.cpp" line="296"/>
         <source>Confirm that the beer is packaged and all data is correct</source>
         <translation type="unfinished"></translation>
     </message>
--- 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 @@
         <translation type="vanished">Batterij volt</translation>
     </message>
     <message>
-        <location filename="../src/EditProductTab11.cpp" line="317"/>
+        <location filename="../src/EditProductTab11.cpp" line="296"/>
         <source>Confirm package</source>
         <translation>Bevestig verpakken</translation>
     </message>
     <message>
-        <location filename="../src/EditProductTab11.cpp" line="317"/>
+        <location filename="../src/EditProductTab11.cpp" line="296"/>
         <source>Confirm that the beer is packaged and all data is correct</source>
         <translation>Bevestig dat het bier verpakt is en de gegevens kloppen</translation>
     </message>

mercurial