www/js/global.js

changeset 372
1365b5e47130
parent 371
023ca640b5af
child 373
ee16d9b844d8
equal deleted inserted replaced
371:023ca640b5af 372:1365b5e47130
292 datafields: [{ name: 'id' }, { name: 'en' }, { name: 'nl' }] 292 datafields: [{ name: 'id' }, { name: 'en' }, { name: 'nl' }]
293 }; 293 };
294 var IBUmethodAdapter = new $.jqx.dataAdapter(IBUmethodSource); 294 var IBUmethodAdapter = new $.jqx.dataAdapter(IBUmethodSource);
295 295
296 var ColorMethodData = [ 296 var ColorMethodData = [
297 { id: 0, en: 'Morey', nl: 'Morey' }, 297 { id: 0, en: 'Morey', nl: 'Morey' },
298 { id: 1, en: 'Mosher', nl: 'Mosher' }, 298 { id: 1, en: 'Mosher', nl: 'Mosher' },
299 { id: 2, en: 'Daniels', nl: 'Daniels' } 299 { id: 2, en: 'Daniels', nl: 'Daniels' },
300 { id: 3, en: 'Halberstadt', nl: 'Halberstadt' }
300 ]; 301 ];
301 var ColorMethodSource = { 302 var ColorMethodSource = {
302 localdata: ColorMethodData, 303 localdata: ColorMethodData,
303 datatype: "array", 304 datatype: "array",
304 datafields: [{ name: 'id' }, { name: 'en' }, { name: 'nl' }] 305 datafields: [{ name: 'id' }, { name: 'en' }, { name: 'nl' }]
733 } 734 }
734 735
735 736
736 737
737 /* 738 /*
739 * Return incremented color by the boil and yeast.
740 * https://www.hobbybrouwen.nl/forum/index.php/topic,19020.msg281132.html#msg281132
741 */
742 function get_kt(ebc) {
743
744 var kt = 1;
745 if (ebc < 3)
746 kt = 3.5;
747 else if (ebc < 6)
748 kt = 3;
749 else if (ebc < 8)
750 kt = 2.75;
751 else if (ebc < 10)
752 kt = 2.5;
753 else if (ebc < 20)
754 kt = 1.8;
755 else if (ebc < 30)
756 kt = 1.6;
757 else if (ebc < 60)
758 kt = 1.3;
759 else if (ebc < 100)
760 kt = 1.2;
761 else if (ebc < 300)
762 kt = 1.1;
763 return kt;
764 }
765
766
767
768 /*
738 * Alcohol By Volume 769 * Alcohol By Volume
739 */ 770 */
740 function abvol(og, fg) { 771 function abvol(og, fg) {
741 772
742 if (((og - fg) < 0) || (fg < 0.9)) 773 if (((og - fg) < 0) || (fg < 0.9))
766 } 797 }
767 798
768 799
769 800
770 /* 801 /*
771 * Kleurwerking naar SRM 802 * Kleurwerking naar SRM. Niet voor Halberstadt.
772 */ 803 */
773 function kw_to_srm(colormethod, c) { 804 function kw_to_srm(colormethod, c) {
774 805
775 if (colormethod == 0) // Morey 806 if (colormethod == 0) // Morey
776 return 1.4922 * Math.pow(c, 0.6859); 807 return 1.4922 * Math.pow(c, 0.6859);
777 if (colormethod == 1) // Mosher 808 if (colormethod == 1) // Mosher
778 return 0.3 * c + 4.7; 809 return 0.3 * c + 4.7;
779 if (colormethod == 2) // Daniels 810 if (colormethod == 2) // Daniels
780 return 0.2 * c + 8.4; 811 return 0.2 * c + 8.4;
812 if (colormethod == 3) // Halberstadt
813 return 0;
781 } 814 }
782 815
783 816
784 817
785 function kw_to_ebc(colormethod, c) { 818 function kw_to_ebc(colormethod, c) {

mercurial