diff -r a8e065a9f851 -r 10cc2400b5d5 www/js/rec_edit.js --- a/www/js/rec_edit.js Mon Dec 02 20:56:01 2019 +0100 +++ b/www/js/rec_edit.js Tue Dec 03 13:36:24 2019 +0100 @@ -494,9 +494,13 @@ } -function GetOptClSO4ratio() { - var BUGU = GetBUGU(); - return (-1.2 * BUGU + 1.4); +function GetOptSO4Clratio() { + if (parseFloat($('#pr_sulfate').jqxNumberInput('decimal')) > 0 && parseFloat($('#pr_chloride').jqxNumberInput('decimal'))) { + return (parseFloat($('#pr_sulfate').jqxNumberInput('decimal')) / parseFloat($('#pr_chloride').jqxNumberInput('decimal'))); + } else { + var BUGU = GetBUGU(); + return (-1.2 * BUGU + 1.4); + } } @@ -1534,6 +1538,13 @@ { name: 'y_cells', type: 'float' }, { name: 'y_tolerance', type: 'float' }, { name: 'y_inventory', type: 'float' }, + { name: 'y_sta1', type: 'int' }, + { name: 'y_bacteria', type: 'int' }, + { name: 'y_harvest_top', type: 'int' }, + { name: 'y_harvest_time', type: 'int' }, + { name: 'y_pitch_temperature', type: 'float' }, + { name: 'y_pofpos', type: 'int' }, + { name: 'y_zymocide', type: 'int' }, { name: 'y_avail', type: 'int' } ], addrow: function(rowid, rowdata, position, commit) { @@ -1600,6 +1611,13 @@ row['y_cells'] = datarecord.cells; row['y_tolerance'] = datarecord.tolerance; row['y_inventory'] = datarecord.inventory; + row['y_sta1'] = datarecord.sta1; + row['y_bacteria'] = datarecord.bacteria; + row['y_harvest_top'] = datarecord.harvest_top; + row['y_harvest_time'] = datarecord.harvest_time; + row['y_pitch_temperature'] = datarecord.pitch_temperature; + row['y_pofpos'] = datarecord.pofpos; + row['y_zymocide'] = datarecord.zymocide; $('#yeastGrid').jqxGrid('addrow', null, row); } $('#yaddrowbutton').jqxDropDownList('clearSelection'); @@ -1920,7 +1938,7 @@ AT, BT, result, pK1, pK2, pK3, MolWt, AcidSG, AcidPrc, r1d, r2d, f1d, f2d, f3d, deltapH, deltapd, pd, n, - piCLSO4_low, piCLSO4_high, Res, + Res, wg_calcium, wg_sodium, wg_total_alkalinity, wg_chloride, wg_sulfate, wg_bicarbonate; if (dataRecord.w1_name == '') { @@ -2226,39 +2244,50 @@ chloride = wg_chloride + RA; } - // 2:1 Sulfate to Chroride IPA's, Pale Ales. - // 1:1 Sulfate to Chloride Balanced - // 1:2 Sulfate to Chloride Malty - // Note, values below are the other way, cl to so4! - // So: 0.5 is IPA's, Pale Ales. - // 1 Balanced - // 2 Malty. - $('#tgt_bu').val(Math.round(GetBUGU() * 100) / 100); + var BUGU = GetBUGU(); + $('#tgt_bu').val(Round(BUGU, 2)); // From brouwhulp. - if (GetBUGU() < 0.32) + if (BUGU < 0.32) $('#wr_bu').html("Zeer moutig en zoet"); - else if (GetBUGU() < 0.43) + else if (BUGU < 0.43) $('#wr_bu').html("Moutig, zoet"); - else if (GetBUGU() < 0.52) + else if (BUGU < 0.52) $('#wr_bu').html("Evenwichtig"); - else if (GetBUGU() < 0.63) + else if (BUGU < 0.63) $('#wr_bu').html("Licht hoppig, bitter"); else $('#wr_bu').html("Extra hoppig, zeer bitter"); - $('#tgt_cl_so4').val(Math.round(GetOptClSO4ratio() * 10) / 10); - if (sulfate > 0) - RA = chloride / sulfate; + + // Sulfate to Chloride ratio (Palmer). + var OptSO4Clratio = GetOptSO4Clratio(); + $('#tgt_so4_cl').val(Round(OptSO4Clratio, 1)); + if (OptSO4Clratio < 0.4) + $('#wrt_so4_cl').html("Te moutig"); + else if (OptSO4Clratio < 0.6) + $('#wrt_so4_cl').html("Zeer moutig"); + else if (OptSO4Clratio < 0.8) + $('#wrt_so4_cl').html("Moutig"); + else if (OptSO4Clratio < 1.5) + $('#wrt_so4_cl').html("Gebalanceerd"); + else if (OptSO4Clratio < 2.0) + $('#wrt_so4_cl').html("Licht bitter"); + else if (OptSO4Clratio < 4.0) + $('#wrt_so4_cl').html("Bitter"); + else if (OptSO4Clratio < 9.0) + $('#wrt_so4_cl').html("Zeer bitter"); + else + $('#wrt_so4_cl').html("Te bitter"); + if (chloride > 0) + RA = sulfate / chloride; else RA = 10; - $('#got_cl_so4').val(Math.round(RA * 10) / 10); - piCLSO4_low = 0.8 * GetOptClSO4ratio(); - piCLSO4_high = 1.2 * GetOptClSO4ratio(); + $('#got_so4_cl').val(Round(RA, 1)); Res = 'normaal'; - if (RA < piCLSO4_low) + if (RA < (0.8 * OptSO4Clratio)) Res = 'laag'; - else if (RA > piCLSO4_high) + else if (RA > (1.2 * OptSO4Clratio)) Res = 'hoog'; - setRangeIndicator('cl_so4', Res); + setRangeIndicator('so4_cl', Res); $('#wb_calcium').val(Round(calcium, 1)); $('#wb_magnesium').val(Round(magnesium, 1)); @@ -3514,6 +3543,13 @@ y_cells: yeastData.y_cells, y_tolerance: yeastData.y_tolerance, y_inventory: yeastData.y_inventory, + y_sta1: yeastData.y_sta1, + y_bacteria: yeastData.y_bacteria, + y_harvest_top: yeastData.y_harvest_top, + y_harvest_time: yeastData.y_harvest_time, + y_pitch_temperature: yeastData.y_pitch_temperature, + y_pofpos: yeastData.y_pofpos, + y_zymocide: yeastData.y_zymocide, y_avail: yeastData.y_avail }; $('#yeastGrid').jqxGrid('updaterow', rowID, row); @@ -3560,9 +3596,16 @@ yeastData.y_attenuation = datarecord.attenuation; yeastData.y_cells = datarecord.cells; yeastData.y_inventory = datarecord.inventory; + yeastData.y_sta1 = datarecord.sta1; + 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; + yeastData.y_pofpos = datarecord.pofpos; + yeastData.y_zymocide = datarecord.zymocide; if (yeastData.y_form == 0) { $('#wy_pmpt_amount').html('Pak(ken):'); - } else if (yeastData.y_form == 1) { + } else if (yeastData.y_form == 1 || yeastData.y_form == 6) { $('#wy_pmpt_amount').html('Gewicht gram:'); } else { $('#wy_pmpt_amount').html('Volume ml:'); @@ -3746,8 +3789,8 @@ // Tab 7, Water $('#tgt_bu').jqxNumberInput(Show2wat); - $('#tgt_cl_so4').jqxNumberInput(Show1wat); - $('#got_cl_so4').jqxNumberInput(Show1wat); + $('#tgt_so4_cl').jqxNumberInput(Show1wat); + $('#got_so4_cl').jqxNumberInput(Show1wat); // Water source 1 $('#w1_name').jqxDropDownList({ @@ -3880,6 +3923,7 @@ $('#pr_sodium').val(datarecord.sodium); $('#pr_magnesium').val(datarecord.magnesium); $('#pr_total_alkalinity').val(datarecord.total_alkalinity); + calcWater(); } }); $('#pr_calcium').jqxNumberInput(Show1wat);