src/Utils.cpp

changeset 452
c4c5d02131be
parent 450
d4cff87ea156
child 453
fc0c10d79539
--- a/src/Utils.cpp	Mon Jan 09 15:35:04 2023 +0100
+++ b/src/Utils.cpp	Mon Jan 09 17:03:19 2023 +0100
@@ -296,8 +296,8 @@
 	BD = wgratio;
 	if (BD < 2)
 	    BD = 2;
-	if (BD > 5.5)
-	    BD = 5.5;
+	if (BD > 6)
+	    BD = 6;
     } else {
 	BD = 3.5;
 	mashtemp = 67;
@@ -305,17 +305,19 @@
     }
     if (svg < 30)
 	svg = 77;
+    if (mashtime > 240)
+	mashtime = 240;
 
     /*
      * Original from brouwhulp:
-     * 0.00825 Attenuation factor yeast (Real to apparant ??)
-     * 0.00817 Attenuation factor water/grain ratio
+     *  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
+     *  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.
+     *  0.00553 Attenuation factor percentage simple sugars
+     *  0.547   Attenuation factor constant
+     *  0.597   Attenuation factor constant when STA1 gen is true.
      */
     double top_mashtemp = 66.11;	/* Highest fermentable at 151 degrees fahrenheit */
     /*
@@ -323,15 +325,15 @@
      */
     if (mashtemp > top_mashtemp) {
 	/* Above optimum mash temperature decrease attenuation */
-        att_mashtemp = - 0.00684 * mashtemp;
+        att_mashtemp = -0.00684 * mashtemp;
     } else {
 	/* Below optimum mash temperature decrease slowly attenuation */
-        att_mashtemp = - 0.00684 * (top_mashtemp + (top_mashtemp - mashtemp) / 4);
+        att_mashtemp = -0.00684 * (top_mashtemp + (top_mashtemp - mashtemp) / 4);
     }
 
     double AttBeer = 0.00825 * svg + 0.00817 * BD + att_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;
+    qDebug() << "estimate_fg(" << psugar << pcara << BD << mashtime << mashtemp << svg << og << sta1 << ") AttBeer:" << AttBeer;
     return round((1 + (1 - AttBeer) * (og -1)) * 10000) / 10000;
 }
 

mercurial