www/js/prod_edit.js

changeset 643
9ac2fb6b1311
parent 642
9d1af81b20ef
child 644
4654b8ee4690
equal deleted inserted replaced
642:9d1af81b20ef 643:9ac2fb6b1311
62 ok_hops = 1, // Hops are in stock 62 ok_hops = 1, // Hops are in stock
63 ok_miscs = 1, // Miscs are in stock 63 ok_miscs = 1, // Miscs are in stock
64 ok_yeasts = 1, // Yeasts are in stock 64 ok_yeasts = 1, // Yeasts are in stock
65 ok_waters = 1, // Waters are in stock 65 ok_waters = 1, // Waters are in stock
66 66
67 data_loaded = 0;
67 error_count = 0; 68 error_count = 0;
68 69
69 hop_flavour = 0, 70 hop_flavour = 0,
70 hop_aroma = 0, 71 hop_aroma = 0,
71 mash_infuse = 0, 72 mash_infuse = 0,
565 editMash(dataRecord); 566 editMash(dataRecord);
566 console.log('main data loaded'); 567 console.log('main data loaded');
567 calcStage(); 568 calcStage();
568 $('#jqxTabs').jqxTabs('select', 2); 569 $('#jqxTabs').jqxTabs('select', 2);
569 console.log('main data ready'); 570 console.log('main data ready');
571 data_loaded = 1;
570 }, 572 },
571 loadError: function(jqXHR, status, error) { 573 loadError: function(jqXHR, status, error) {
572 console.log('main data load error: ' + status + ' ' + error); 574 console.log('main data load error: ' + status + ' ' + error);
573 } 575 }
574 }); 576 });
2779 } 2781 }
2780 return Result; 2782 return Result;
2781 } 2783 }
2782 2784
2783 function MashpH() { 2785 function MashpH() {
2786
2784 console.log('MashpH()'); 2787 console.log('MashpH()');
2785 var n = 0, pH = 5.4, deltapH = 0.001, deltapd = 0.1, pd = ProtonDeficit(pH); 2788 var n = 0, pH = 5.4, deltapH = 0.001, deltapd = 0.1, pd = ProtonDeficit(pH);
2786 while (((pd < -deltapd) || (pd > deltapd)) && (n < 2000)) { 2789 while (((pd < -deltapd) || (pd > deltapd)) && (n < 2000)) {
2787 n++; 2790 n++;
2788 if (pd < -deltapd) 2791 if (pd < -deltapd)
2809 } 2812 }
2810 } 2813 }
2811 2814
2812 function calcWater() { 2815 function calcWater() {
2813 2816
2814 //console.log('calcWater()'); 2817 console.log('calcWater()');
2818 if (! data_loaded) {
2819 console.log('failsave');
2820 return;
2821 }
2822
2815 var liters = 0, 2823 var liters = 0,
2816 calcium = 0, 2824 calcium = 0,
2817 magnesium = 0, 2825 magnesium = 0,
2818 sodium = 0, 2826 sodium = 0,
2819 total_alkalinity = 0, 2827 total_alkalinity = 0,
2868 $('#wg_chloride').val(Math.round(chloride * 10) / 10); 2876 $('#wg_chloride').val(Math.round(chloride * 10) / 10);
2869 wg_sulfate = sulfate; 2877 wg_sulfate = sulfate;
2870 $('#wg_sulfate').val(Math.round(sulfate * 10) / 10); 2878 $('#wg_sulfate').val(Math.round(sulfate * 10) / 10);
2871 // Note: brouwhulp has the malts included here in the result. 2879 // Note: brouwhulp has the malts included here in the result.
2872 //var wg_ph = ph; 2880 //var wg_ph = ph;
2881 var mash_ph = Round(MashpH(), 1);
2873 $('#wg_ph').val(Round(ph, 1)); 2882 $('#wg_ph').val(Round(ph, 1));
2874 $('#wb_ph').val(Round(MashpH(), 1)); 2883 $('#wb_ph').val(mash_ph);
2875 $('#est_mash_ph').val(Round(MashpH(), 1)); 2884 $('#est_mash_ph').val(mash_ph);
2876 bicarbonate = total_alkalinity * 1.22; 2885 bicarbonate = total_alkalinity * 1.22;
2877 wg_bicarbonate = bicarbonate; 2886 wg_bicarbonate = bicarbonate;
2878 2887
2879 // Noot: de volgende berekeningen geven bijna gelijke resultaten in Brun'water. 2888 // Noot: de volgende berekeningen geven bijna gelijke resultaten in Brun'water.
2880 // Calculate Ca 2889 // Calculate Ca

mercurial