Fixed calculation of estimated fg and use the same method as in bmsapp.

Fri, 05 Aug 2022 20:11:11 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Fri, 05 Aug 2022 20:11:11 +0200
changeset 824
26ffc2fb0eaf
parent 823
506246d65043
child 825
8b87ad5bd3c3

Fixed calculation of estimated fg and use the same method as in bmsapp.

www/js/prod_edit.js file | annotate | diff | comparison | revisions
--- a/www/js/prod_edit.js	Fri Aug 05 16:07:05 2022 +0200
+++ b/www/js/prod_edit.js	Fri Aug 05 20:11:11 2022 +0200
@@ -1479,6 +1479,7 @@
   addedS = 0,       // Added sugars after boil
   addedmass = 0,    // Added mass after boil
   mvol = 0,         // mash volume
+  infuse = 0,	    // mash infuse volume
   colort = 0,       // Colors srm * vol totals
   colorh = 0,       // Colors ebc * vol * kt
   colorn = 0,       // Colors ebc * pt * pct
@@ -1503,14 +1504,15 @@
     row = dataRecord.mashs[i];
     if (parseFloat(row.step_type) == 0) // Infusion
      mvol += parseFloat(row.step_infuse_amount);
-    if (row.step_temp <= 75) { // Ignore mashout
-     timem = row.step_time + row.ramp_time;
+    if (row.step_temp <= 75 && row.step_temp >= 60) { // Ignore mashout
+     timem = row.step_time;
+     if (i > 0)
+      timem += row.ramp_time;
      mashtime += timem;
      mashtemp += timem * row.step_temp;
     }
    }
-   if (mashtime > 5)
-    mashtime -= 5; //Correct last ramp > 75
+   infuse = mvol;
    mashtemp = Round(mashtemp / mashtime, 2);
   } else {
    console.log("calcFermentables() no mash steps");
@@ -1695,9 +1697,8 @@
   calcSupplies();
   if (svg == 0)
    svg = 77;
-
-  if ((mashkg > 0) && (mash_infuse > 0) && (mashtime > 0) && (mashtemp > 0)) {
-   dataRecord.est_fg = estimate_fg(psugar, pcara, mash_infuse / mashkg, mashtime, mashtemp, svg, dataRecord.est_og);
+  if ((mashkg > 0) && (infuse > 0) && (mashtime > 0) && (mashtemp > 0)) {
+   dataRecord.est_fg = estimate_fg(psugar, pcara, infuse / mashkg, mashtime, mashtemp, svg, dataRecord.est_og);
   } else {
    dataRecord.est_fg = estimate_fg(psugar, pcara, 0, 0, 0, svg, dataRecord.est_og);
   }

mercurial