# HG changeset patch # User Michiel Broek # Date 1575203732 -3600 # Node ID ee0db754111ed5150353ab0d4b9063664d6eb705 # Parent 57cb71496a9ae377f5b86be3e6d87e2209c108f9 In calcWater() the optimum SO4:Cl ratio is taken from the target profile if set, else it's calculated from the BUGU value. Swapped Cl:SO4 to SO4:Cl ratio presentation. Added remark text next to the Optimal SO4:Cl ratio. diff -r 57cb71496a9a -r ee0db754111e www/js/prod_edit.js --- a/www/js/prod_edit.js Sat Nov 23 11:34:33 2019 +0100 +++ b/www/js/prod_edit.js Sun Dec 01 13:35:32 2019 +0100 @@ -2599,9 +2599,13 @@ return 0.5; } - 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.0 / (-1.2 * BUGU + 1.4)); + } } function setWaterAgent(name, amount) { @@ -3099,13 +3103,6 @@ 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(Round(GetBUGU(), 2)); // From brouwhulp. if (GetBUGU() < 0.32) @@ -3118,20 +3115,38 @@ $('#wr_bu').html("Licht hoppig, bitter"); else $('#wr_bu').html("Extra hoppig, zeer bitter"); - $('#tgt_cl_so4').val(Round(GetOptClSO4ratio(), 1)); - if (sulfate > 0) - RA = chloride / sulfate; + + // Sulfate to Chloride ratio (Palmer). + $('#tgt_so4_cl').val(Round(GetOptSO4Clratio(), 1)); + if (GetOptSO4Clratio() < 0.4) + $('#wrt_so4_cl').html("Te moutig"); + else if (GetOptSO4Clratio() < 0.6) + $('#wrt_so4_cl').html("Zeer moutig"); + else if (GetOptSO4Clratio() < 0.8) + $('#wrt_so4_cl').html("Moutig"); + else if (GetOptSO4Clratio() < 1.5) + $('#wrt_so4_cl').html("Gebalanceerd"); + else if (GetOptSO4Clratio() < 2.0) + $('#wrt_so4_cl').html("Licht bitter"); + else if (GetOptSO4Clratio() < 4.0) + $('#wrt_so4_cl').html("Bitter"); + else if (GetOptSO4Clratio() < 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(Round(RA, 1)); - piCLSO4_low = 0.8 * GetOptClSO4ratio(); - piCLSO4_high = 1.2 * GetOptClSO4ratio(); + $('#got_so4_cl').val(Round(RA, 1)); + piCLSO4_low = 0.8 * GetOptSO4Clratio(); + piCLSO4_high = 1.2 * GetOptSO4Clratio(); Res = 'normaal'; if (RA < piCLSO4_low) Res = 'laag'; else if (RA > piCLSO4_high) Res = 'hoog'; - setRangeIndicator('cl_so4', Res); + setRangeIndicator('so4_cl', Res); $('#wb_calcium').val(Round(calcium, 1)); $('#wb_magnesium').val(Round(magnesium, 1)); @@ -5543,8 +5558,8 @@ // Tab 8, 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({ @@ -5680,6 +5695,7 @@ $('#pr_sodium').val(datarecord.sodium); $('#pr_magnesium').val(datarecord.magnesium); $('#pr_total_alkalinity').val(datarecord.total_alkalinity); + calcWater(); } }); $('#pr_calcium').jqxNumberInput(Show1wat); diff -r 57cb71496a9a -r ee0db754111e www/prod_edit.php --- a/www/prod_edit.php Sat Nov 23 11:34:33 2019 +0100 +++ b/www/prod_edit.php Sun Dec 01 13:35:32 2019 +0100 @@ -379,10 +379,10 @@ Bitterheidsindex:
- Richtgetal Cl/SO4: -
- Huidig Cl/SO4: -
+ Richtgetal SO4:Cl: +
+ Huidig SO4:Cl: +