www/js/rec_edit.js

changeset 347
e6e7ec9e33e0
parent 343
82184e3be6d9
child 348
5fc0f4b42224
equal deleted inserted replaced
346:01b393df529a 347:e6e7ec9e33e0
534 } 534 }
535 } 535 }
536 } 536 }
537 537
538 function setRangeIndicator(ion, rangeCode) { 538 function setRangeIndicator(ion, rangeCode) {
539 if (rangeCode == "low") 539 if (rangeCode == "laag")
540 $("#wr_"+ion).html("<img src='images/dialog-error.png'><span style='font-size: 10px; font-style: italic;'>"+rangeCode + "</span>"); 540 $("#wr_"+ion).html("<img src='images/dialog-error.png'><span style='vertical-align: top; font-size: 10px; font-style: italic;'>"+rangeCode + "</span>");
541 else if (rangeCode == "high") 541 else if (rangeCode == "hoog")
542 $("#wr_"+ion).html("<img src='images/dialog-error.png'><span style='font-size: 10px; font-style: italic;'>"+rangeCode+"</span>"); 542 $("#wr_"+ion).html("<img src='images/dialog-error.png'><span style='vertical-align: top; font-size: 10px; font-style: italic;'>"+rangeCode+"</span>");
543 else 543 else
544 $("#wr_"+ion).html("<img src='images/dialog-ok-apply.png'>"); 544 $("#wr_"+ion).html("<img src='images/dialog-ok-apply.png'>");
545 } 545 }
546 546
547 function mix(v1, v2, c1, c2) { 547 function mix(v1, v2, c1, c2) {
1014 } 1014 }
1015 1015
1016 // 2:1 Sulfate to Chroride IPA's, Pale Ales. 1016 // 2:1 Sulfate to Chroride IPA's, Pale Ales.
1017 // 1:1 Sulfate to Chloride Balanced 1017 // 1:1 Sulfate to Chloride Balanced
1018 // 1:2 Sulfate to Chloride Malty 1018 // 1:2 Sulfate to Chloride Malty
1019 // Note, values below are the other way, cl to so4!
1020 // So: 0.5 is IPA's, Pale Ales.
1021 // 1 Balanced
1022 // 2 Malty.
1019 $('#tgt_bu').val(Math.round(GetBUGU() * 100) / 100); 1023 $('#tgt_bu').val(Math.round(GetBUGU() * 100) / 100);
1020 $('#tgt_cl_so4').val(Math.round(GetOptClSO4ratio() * 10) / 10); // Show real value too 1024 // From brouwhulp.
1025 if (GetBUGU() < 0.32)
1026 $('#wr_bu').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Zeer zoet</span>");
1027 else if (GetBUGU() < 0.43)
1028 $('#wr_bu').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Zoet</span>");
1029 else if (GetBUGU() < 0.52)
1030 $('#wr_bu').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Evenwichtig</span>");
1031 else if (GetBUGU() < 0.63)
1032 $('#wr_bu').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Bitter</span>");
1033 else
1034 $('#wr_bu').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Zeer bitter</span>");
1035 $('#tgt_cl_so4').val(Math.round(GetOptClSO4ratio() * 10) / 10);
1021 if (sulfate > 0) 1036 if (sulfate > 0)
1022 RA = chloride / sulfate; 1037 RA = chloride / sulfate;
1023 else 1038 else
1024 RA = 10; 1039 RA = 10;
1040 $('#got_cl_so4').val(Math.round(RA * 10) / 10);
1025 var piCLSO4_low = 0.8 * GetOptClSO4ratio(); 1041 var piCLSO4_low = 0.8 * GetOptClSO4ratio();
1026 var piCLSO4_high = 1.2 * GetOptClSO4ratio(); 1042 var piCLSO4_high = 1.2 * GetOptClSO4ratio();
1027 console.log("low: "+piCLSO4_low+" val: "+RA+" high: "+piCLSO4_high); 1043 var Res = 'normaal';
1044 if (RA < piCLSO4_low)
1045 Res = 'laag';
1046 else if (RA > piCLSO4_high)
1047 Res = 'hoog';
1048 setRangeIndicator('cl_so4', Res);
1028 1049
1029 $('#wb_calcium').val(Math.round(calcium * 10) / 10); 1050 $('#wb_calcium').val(Math.round(calcium * 10) / 10);
1030 $('#wb_magnesium').val(Math.round(magnesium * 10) / 10); 1051 $('#wb_magnesium').val(Math.round(magnesium * 10) / 10);
1031 $('#wb_sodium').val(Math.round(sodium * 10) / 10); 1052 $('#wb_sodium').val(Math.round(sodium * 10) / 10);
1032 $('#wb_sulfate').val(Math.round(sulfate * 10) / 10); 1053 $('#wb_sulfate').val(Math.round(sulfate * 10) / 10);
1033 $('#wb_chloride').val(Math.round(chloride * 10) / 10); 1054 $('#wb_chloride').val(Math.round(chloride * 10) / 10);
1034 $('#wb_total_alkalinity').val(Math.round(total_alkalinity * 10) / 10); 1055 $('#wb_total_alkalinity').val(Math.round(total_alkalinity * 10) / 10);
1035 1056
1036 if (calcium < 40) { 1057 if (calcium < 40) {
1037 setRangeIndicator("calcium", "low"); 1058 setRangeIndicator("calcium", "laag");
1038 } else if (calcium > 150) { 1059 } else if (calcium > 150) {
1039 setRangeIndicator("calcium", "high"); 1060 setRangeIndicator("calcium", "hoog");
1040 } else { 1061 } else {
1041 setRangeIndicator("calcium", "normal"); 1062 setRangeIndicator("calcium", "normaal");
1042 } 1063 }
1043 if (magnesium >= 0 && magnesium <= 30) { 1064 if (magnesium >= 0 && magnesium <= 30) {
1044 setRangeIndicator("magnesium", "normal"); 1065 setRangeIndicator("magnesium", "normaal");
1045 } else { 1066 } else {
1046 setRangeIndicator("magnesium", "high"); 1067 setRangeIndicator("magnesium", "hoog");
1047 } 1068 }
1048 if (sodium <= 150) { 1069 if (sodium <= 150) {
1049 setRangeIndicator("sodium", "normal"); 1070 setRangeIndicator("sodium", "normaal");
1050 } else { 1071 } else {
1051 setRangeIndicator("sodium", "high"); 1072 setRangeIndicator("sodium", "hoog");
1052 } 1073 }
1053 if (chloride <= 100) { 1074 // Both chloride and sulfate should be above 50 according to
1054 setRangeIndicator("chloride", "normal"); 1075 // John Palmer. So the Cl/SO4 ratio calculation will work.
1076 if (chloride <= 50) {
1077 setRangeIndicator("chloride", "laag");
1078 } else if (chloride <= 100) {
1079 setRangeIndicator("chloride", "normaal");
1055 } else { 1080 } else {
1056 setRangeIndicator("chloride", "high"); 1081 setRangeIndicator("chloride", "hoog");
1057 } 1082 }
1058 if (sulfate <= 350) { 1083 if (sulfate <= 50) {
1059 setRangeIndicator("sulfate", "normal"); 1084 setRangeIndicator("sulfate", "laag");
1085 } else if (sulfate <= 350) {
1086 setRangeIndicator("sulfate", "normaal");
1060 } else { 1087 } else {
1061 setRangeIndicator("sulfate", "high"); 1088 setRangeIndicator("sulfate", "hoog");
1062 } 1089 }
1063 if (ph < 5.2) { 1090 if (ph < 5.2) {
1064 setRangeIndicator("ph", "low"); 1091 setRangeIndicator("ph", "laag");
1065 } else if (ph > 5.6) { 1092 } else if (ph > 5.6) {
1066 setRangeIndicator("ph", "high"); 1093 setRangeIndicator("ph", "hoog");
1067 } else { 1094 } else {
1068 setRangeIndicator("ph", "normal"); 1095 setRangeIndicator("ph", "normaal");
1069 } 1096 }
1070 calcSparge(); 1097 calcSparge();
1071 } 1098 }
1072 1099
1073 function calcSparge() { 1100 function calcSparge() {
3496 }); 3523 });
3497 3524
3498 // Tab 7, Water 3525 // Tab 7, Water
3499 $("#tgt_bu").jqxNumberInput( Show2wat ); 3526 $("#tgt_bu").jqxNumberInput( Show2wat );
3500 $("#tgt_cl_so4").jqxNumberInput( Show1wat ); 3527 $("#tgt_cl_so4").jqxNumberInput( Show1wat );
3528 $("#got_cl_so4").jqxNumberInput( Show1wat );
3501 3529
3502 // Water source 1 3530 // Water source 1
3503 $("#w1_name").jqxDropDownList({ 3531 $("#w1_name").jqxDropDownList({
3504 placeHolder: "Kies hoofd water:", 3532 placeHolder: "Kies hoofd water:",
3505 theme: theme, 3533 theme: theme,
3601 $("#wb_calcium").jqxNumberInput( Show1wat ); 3629 $("#wb_calcium").jqxNumberInput( Show1wat );
3602 $("#wb_magnesium").jqxTooltip({ content: 'De ideale hoeveelheid Magnesium is lager dan 30.'}); 3630 $("#wb_magnesium").jqxTooltip({ content: 'De ideale hoeveelheid Magnesium is lager dan 30.'});
3603 $("#wb_magnesium").jqxNumberInput( Show1wat ); 3631 $("#wb_magnesium").jqxNumberInput( Show1wat );
3604 $("#wb_sodium").jqxTooltip({ content: 'De ideale hoeveelheid Natrium is lager dan 150.'}); 3632 $("#wb_sodium").jqxTooltip({ content: 'De ideale hoeveelheid Natrium is lager dan 150.'});
3605 $("#wb_sodium").jqxNumberInput( Show1wat ); 3633 $("#wb_sodium").jqxNumberInput( Show1wat );
3606 $("#wb_chloride").jqxTooltip({ content: 'De ideale hoeveelheid Chloride is lager dan 100.'}); 3634 $("#wb_chloride").jqxTooltip({ content: 'De ideale hoeveelheid Chloride is tussen 50 en 100.'});
3607 $("#wb_chloride").jqxNumberInput( Show1wat ); 3635 $("#wb_chloride").jqxNumberInput( Show1wat );
3608 $("#wb_sulfate").jqxTooltip({ content: 'De ideale hoeveelheid Sulfaat is lager dan 350.'}); 3636 $("#wb_sulfate").jqxTooltip({ content: 'De ideale hoeveelheid Sulfaat is tussen 50 en 350.'});
3609 $("#wb_sulfate").jqxNumberInput( Show1wat ); 3637 $("#wb_sulfate").jqxNumberInput( Show1wat );
3610 $("#wb_total_alkalinity").jqxNumberInput( Show1wat ); 3638 $("#wb_total_alkalinity").jqxNumberInput( Show1wat );
3611 $("#wb_ph").jqxNumberInput( Show1wat ); 3639 $("#wb_ph").jqxNumberInput( Show1wat );
3612 // Water target profile 3640 // Water target profile
3613 $("#pr_name").jqxDropDownList({ 3641 $("#pr_name").jqxDropDownList({

mercurial