Changed priming sugar calculation to Brew by the Numbers by Michael L. Hall. This gives a bit higher and better amount of sugar to use. Removed dead parameter from the ResCO2 function.

Wed, 15 Apr 2020 20:18:00 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Wed, 15 Apr 2020 20:18:00 +0200
changeset 651
6e89cb158153
parent 650
fd7da9570810
child 652
a5d9ec7e2239

Changed priming sugar calculation to Brew by the Numbers by Michael L. Hall. This gives a bit higher and better amount of sugar to use. Removed dead parameter from the ResCO2 function.

www/js/prod_edit.js file | annotate | diff | comparison | revisions
--- a/www/js/prod_edit.js	Fri Apr 10 17:06:38 2020 +0200
+++ b/www/js/prod_edit.js	Wed Apr 15 20:18:00 2020 +0200
@@ -3405,20 +3405,21 @@
   }
  }
 
- function ResCO2(CO2, T) {
+ function ResCO2(T) {
   var F = T * 1.8 + 32;
-  return 3.0378 - 0.050062 * F + 0.00026555 * F * F;
+  return Round(3.0378 - 0.050062 * F + 0.00026555 * F * F, 6);
  }
 
  function CarbCO2toS(CO2, T, SFactor) {
-  var sugar = SFactor * (CO2 - ResCO2(CO2, T)) / 0.286;
+  //var sugar = SFactor * (CO2 - ResCO2(CO2, T)) / 0.286;
+  var sugar = Round(SFactor * (CO2 - ResCO2(T)) * 4.014094, 6);
   if (sugar < 0)
    sugar = 0;
   return Round(sugar, 3);
  }
 
  function GetPressure(CO2, T1, T2) {
-  var P, V = CO2 - ResCO2(CO2, T1);
+  var P, V = CO2 - ResCO2(T1);
   V = CO2; // TODO: temp only total pressure, testing
   if (V < 0)
    return 0;
@@ -3427,7 +3428,7 @@
   if (P < 0)
    P = 0;
   P = Round(P * 1.01325, 2); // atm to bar
-  console.log("GetPressure(" + CO2 + ", " + T1 + ", " + T2 + ")  V:" + V + "  Bar: " + P + " ignored ResCO2: " + Round(ResCO2(CO2, T1), 2));
+  console.log("GetPressure(" + CO2 + ", " + T1 + ", " + T2 + ")  V:" + V + "  Bar: " + P + " ignored ResCO2: " + ResCO2(T1));
   return P;
  }
 

mercurial