www/js/prod_edit.js

changeset 561
dc618b8a9552
parent 560
850e82c1021d
child 564
d5fad7d80899
--- a/www/js/prod_edit.js	Wed Dec 04 21:52:37 2019 +0100
+++ b/www/js/prod_edit.js	Thu Dec 05 13:21:41 2019 +0100
@@ -4061,22 +4061,10 @@
    if (dataRecord.brew_fermenter_sg >= 1.020) {
     OBrix = sg_to_brix(dataRecord.brew_fermenter_sg);
     FBrix = parseFloat(event.args.value);
-    // Brouwhulp, werkt zonder brix_correctie, waarom?
-    FG = Round(1.0031 - 0.002318474 * OBrix - 0.000007775 * (OBrix * OBrix) - 0.000000034 * Math.pow(OBrix, 3) +
-         0.00574 * (FBrix) + 0.00003344 * (FBrix * FBrix) + 0.000000086 * Math.pow(FBrix, 3), 4);
-    // from http://seanterrill.com   FGoc = old cubix, FGnc = new cubic, FGnl = new linear
-    var FGoc = Round(1.001843 - 0.002318474 * (OBrix / my_brix_correction) - 0.000007775 * Math.pow(OBrix / my_brix_correction, 2) -
-        0.000000034 * Math.pow(OBrix / my_brix_correction, 3) +
-        0.00574 * (FBrix / my_brix_correction) + 0.00003344 * Math.pow(FBrix / my_brix_correction, 2) +
-        0.000000086 * Math.pow(FBrix / my_brix_correction, 3), 4);
-    var FGnc = Round(1 - 0.0044993 * (OBrix / my_brix_correction) + 0.0117741 * (FBrix / my_brix_correction) +
-        0.000275806 * Math.pow(OBrix / my_brix_correction, 2) - 0.00127169 * Math.pow(FBrix / my_brix_correction, 2) -
-        0.00000727999 * Math.pow(OBrix / my_brix_correction, 3) + 0.0000632929 * Math.pow(FBrix / my_brix_correction, 3), 4);
-    var FGnl = Round(1 - 0.000856829 * (OBrix / my_brix_correction) + 0.00349412 * (FBrix / my_brix_correction), 4);
-    console.log("OBrix:" + OBrix + " FBrix:" + FBrix + " FG:" + FG + ' FGoc:' + FGoc + ' FGnc:' + FGnc + ' FGnl:' + FGnl);
+    FG = brix_to_fg(OBrix, FBrix);
     if (FBrix > 0.05) {
-     $('#primary_end_sg').val(FGnc);
-     dataRecord.primary_end_sg = FGnc;
+     $('#primary_end_sg').val(FG);
+     dataRecord.primary_end_sg = FG;
     }
     calcFermentation();
    }
@@ -4090,20 +4078,10 @@
    if (dataRecord.brew_fermenter_sg >= 1.020) {
     OBrix = sg_to_brix(dataRecord.brew_fermenter_sg);
     FBrix = parseFloat(event.args.value);
-    FG = Round(1.0031 - 0.002318474 * OBrix - 0.000007775 * (OBrix * OBrix) - 0.000000034 * Math.pow(OBrix, 3) +
-         0.00574 * (FBrix) + 0.00003344 * (FBrix * FBrix) + 0.000000086 * Math.pow(FBrix, 3), 4);
-    var FGoc = Round(1.001843 - 0.002318474 * (OBrix / my_brix_correction) - 0.000007775 * Math.pow(OBrix / my_brix_correction, 2) -
-        0.000000034 * Math.pow(OBrix / my_brix_correction, 3) +
-        0.00574 * (FBrix / my_brix_correction) + 0.00003344 * Math.pow(FBrix / my_brix_correction, 2) +
-        0.000000086 * Math.pow(FBrix / my_brix_correction, 3), 4);
-    var FGnc = Round(1 - 0.0044993 * (OBrix / my_brix_correction) + 0.0117741 * (FBrix / my_brix_correction) +
-        0.000275806 * Math.pow(OBrix / my_brix_correction, 2) - 0.00127169 * Math.pow(FBrix / my_brix_correction, 2) -
-        0.00000727999 * Math.pow(OBrix / my_brix_correction, 3) + 0.0000632929 * Math.pow(FBrix / my_brix_correction, 3), 4);
-    var FGnl = Round(1 - 0.000856829 * (OBrix / my_brix_correction) + 0.00349412 * (FBrix / my_brix_correction), 4);
-    console.log("OBrix:" + OBrix + " FBrix:" + FBrix + " FG:" + FG + ' FGoc:' + FGoc + ' FGnc:' + FGnc + ' FGnl:' + FGnl);
+    FG = brix_to_fg(OBrix, FBrix);
     if (FBrix > 0.05) {
-     $('#secondary_end_sg').val(FGnc);
-     dataRecord.secondary_end_sg = FGnc;
+     $('#secondary_end_sg').val(FG);
+     dataRecord.secondary_end_sg = FG;
     }
     calcFermentation();
    }
@@ -4113,21 +4091,10 @@
    if (dataRecord.brew_fermenter_sg >= 1.020) {
     OBrix = sg_to_brix(dataRecord.brew_fermenter_sg);
     FBrix = parseFloat(event.args.value);
-    FG = Round(1.0031 - 0.002318474 * OBrix - 0.000007775 * (OBrix * OBrix) - 0.000000034 * Math.pow(OBrix, 3) +
-         0.00574 * (FBrix) + 0.00003344 * (FBrix * FBrix) + 0.000000086 * Math.pow(FBrix, 3), 4);
-    // from http://seanterrill.com   FGoc = old cubix, FGnc = new cubic, FGnl = new linear
-    var FGoc = Round(1.001843 - 0.002318474 * (OBrix / my_brix_correction) - 0.000007775 * Math.pow(OBrix / my_brix_correction, 2) -
-        0.000000034 * Math.pow(OBrix / my_brix_correction, 3) +
-        0.00574 * (FBrix / my_brix_correction) + 0.00003344 * Math.pow(FBrix / my_brix_correction, 2) +
-        0.000000086 * Math.pow(FBrix / my_brix_correction, 3), 4);
-    var FGnc = Round(1 - 0.0044993 * (OBrix / my_brix_correction) + 0.0117741 * (FBrix / my_brix_correction) +
-        0.000275806 * Math.pow(OBrix / my_brix_correction, 2) - 0.00127169 * Math.pow(FBrix / my_brix_correction, 2) -
-        0.00000727999 * Math.pow(OBrix / my_brix_correction, 3) + 0.0000632929 * Math.pow(FBrix / my_brix_correction, 3), 4);
-    var FGnl = Round(1 - 0.000856829 * (OBrix / my_brix_correction) + 0.00349412 * (FBrix / my_brix_correction), 4);
-    console.log("OBrix:" + OBrix + " FBrix:" + FBrix + " FG:" + FG + ' FGoc:' + FGoc + ' FGnc:' + FGnc + ' FGnl:' + FGnl);
+    FG = brix_to_fg(OBrix, FBrix);
     if (FBrix > 0.05) {
-     $('#fg').val(FGnc);
-     dataRecord.fg = FGnc;
+     $('#fg').val(FG);
+     dataRecord.fg = FG;
     }
     calcFermentation();
    }
@@ -5357,7 +5324,7 @@
    yeastData.y_cells = datarecord.cells;
    yeastData.y_inventory = datarecord.inventory;
    yeastData.y_sta1 = datarecord.sta1;
-   yeastData,y_bacteria = datarecord.bacteria;
+   yeastData.y_bacteria = datarecord.bacteria;
    yeastData.y_harvest_top = datarecord.harvest_top;
    yeastData.y_harvest_time = datarecord.harvest_time;
    yeastData.y_pitch_temperature = datarecord.pitch_temperature;

mercurial