src/Utils.cpp

changeset 449
00757c056ca6
parent 444
4f626d0bb4d4
child 450
d4cff87ea156
--- a/src/Utils.cpp	Sat Dec 03 16:32:24 2022 +0100
+++ b/src/Utils.cpp	Sun Jan 08 15:53:16 2023 +0100
@@ -282,7 +282,7 @@
 }
 
 
-double Utils::estimate_fg(double psugar, double pcara, double wgratio, double mashtime, double mashtemp, double svg, double og)
+double Utils::estimate_fg(double psugar, double pcara, double wgratio, double mashtime, double mashtemp, double svg, double og, bool sta1)
 {
     double BD;
 
@@ -310,16 +310,19 @@
 	svg = 77;
 
     /*
-     * From brouwhulp:
-     * 0.00825 Attenuation factor yeast
+     * Original from brouwhulp:
+     * 0.00825 Attenuation factor yeast (Real to apparant ??)
      * 0.00817 Attenuation factor water/grain ratio
      * -0.00684 Attenuation factor mash temperature
-     * 0.00026 Attenuation factor total mash time  (at some places this is 0.0026 this is wrong!)
+     * 0.00026 Attenuation factor total mash time
      * -0.00356 Attenuation factor percentage crystal malt
      * 0.00553 Attenuation factor percentage simple sugars
      * 0.547 Attenuation factor constant
+     * 0.597 Attenuation factor constant when STA1 gen is true.
      */
-    double AttBeer = 0.00825 * svg + 0.00817 * BD - 0.00684 * mashtemp + 0.00026 * mashtime - 0.00356 * pcara + 0.00553 * psugar + 0.547;
+    double AttBeer = 0.00825 * svg + 0.00817 * BD - 0.00684 * mashtemp + 0.00026 * mashtime - 0.00356 * pcara + 0.00553 * psugar;
+    AttBeer += (sta1) ? 0.597:0.547;
+    qDebug() << "estimate_fg(" << psugar << pcara << wgratio << mashtime << mashtemp << svg << og << sta1 << ") AttBeer:" << AttBeer;
     return round((1 + (1 - AttBeer) * (og -1)) * 10000) / 10000;
 }
 

mercurial