www/js/global.js

changeset 429
0d2cf505957c
parent 428
a5d4467c9201
child 430
6fa1d64f7f16
equal deleted inserted replaced
428:a5d4467c9201 429:0d2cf505957c
146 { id: 0, en: 'Lager', nl: 'Ondergist' }, 146 { id: 0, en: 'Lager', nl: 'Ondergist' },
147 { id: 1, en: 'Ale', nl: 'Bovengist' }, 147 { id: 1, en: 'Ale', nl: 'Bovengist' },
148 { id: 2, en: 'Wheat', nl: 'Tarwegist' }, 148 { id: 2, en: 'Wheat', nl: 'Tarwegist' },
149 { id: 3, en: 'Wine', nl: 'Wijngist' }, 149 { id: 3, en: 'Wine', nl: 'Wijngist' },
150 { id: 4, en: 'Champagne', nl: 'Champagnegist' } 150 { id: 4, en: 'Champagne', nl: 'Champagnegist' }
151 // { id: 5, en: 'Brett', nl: 'Brett' },
152 // { id: 6, en: 'Kveik', nl: 'Kveik' },
153 // { id: 7, en: 'Mixed', nl: 'Mixed' },
154 // { id: 8, en: 'Spontaneous', nl: 'Spontaan' },
155 // { id: 9, en: 'Other', nl: 'Overig' }
151 ]; 156 ];
152 var YeastTypeSource = { 157 var YeastTypeSource = {
153 localdata: YeastTypeData, 158 localdata: YeastTypeData,
154 datatype: "array", 159 datatype: "array",
155 datafields: [{ name: 'id' }, { name: 'en' }, { name: 'nl' }] 160 datafields: [{ name: 'id' }, { name: 'en' }, { name: 'nl' }]
770 775
771 776
772 /* 777 /*
773 * Alcohol By Volume 778 * Alcohol By Volume
774 */ 779 */
775 function abvol(og, fg) { 780 function abvol(og,fg){
776 781
777 if (((og - fg) < 0) || (fg < 0.9)) 782 if(((og-fg)<0)||(fg<0.9))
778 return 0; 783 return 0;
779 784
780 /* 785 /*
781 * Formule van Hans Halberstadt. De constante factor is afhankelijk van de 786 * Formule van Hans Halberstadt. De constante factor is afhankelijk van de
782 * zwaarte van het wort. 787 * zwaarte van het wort.
783 */ 788 */
784 var factor = og * 3157 * Math.pow(10, -5) + 9.716 * Math.pow(10, -2); 789 var factor=og*3157*Math.pow(10,-5)+9.716*Math.pow(10,-2);
785 var result = (og * 1000 - fg * 1000) * factor; 790 return (og*1000-fg*1000)*factor;
786
787 console.log("HH abvol("+ og * 1000 + ", "+ fg * 1000 + ") factor:" + factor + " abv:" + result);
788 return result;
789 791
790 /* 792 /*
791 * Dit lijkt goed en wordt in veel moderne software gebruikt, maar... 793 * Dit lijkt goed en wordt in veel moderne software gebruikt, maar...
792 * dit klopt niet. Busted door Hans Halberstadt. 794 * dit klopt niet. Busted door Hans Halberstadt.
793 * return (76.08 * (og-fg) / (1.775-og)) * (fg / 0.794); // Daniels 795 * return (76.08 * (og-fg) / (1.775-og)) * (fg / 0.794); // Daniels
804 806
805 /* 807 /*
806 * Kleurwerking naar SRM. Niet voor Halberstadt, Naudts 808 * Kleurwerking naar SRM. Niet voor Halberstadt, Naudts
807 */ 809 */
808 function kw_to_srm(colormethod, c) { 810 function kw_to_srm(colormethod, c) {
809 811 if(colormethod==0)// Morey
810 if (colormethod == 0) // Morey 812 return 1.4922*Math.pow(c,0.6859);
811 return 1.4922 * Math.pow(c, 0.6859); 813 if(colormethod==1)// Mosher
812 if (colormethod == 1) // Mosher 814 return 0.3*c+4.7;
813 return 0.3 * c + 4.7; 815 if(colormethod==2)// Daniels
814 if (colormethod == 2) // Daniels 816 return 0.2*c+8.4;
815 return 0.2 * c + 8.4; 817 if(colormethod==3)// Halberstadt
816 if (colormethod == 3) // Halberstadt
817 return 0; 818 return 0;
818 if (colormethod == 4) 819 if(colormethod==4)// Naudts
819 return 0; 820 return 0;
820 } 821 }
821 822
822 823
823 824
824 function kw_to_ebc(colormethod, c) { 825 function kw_to_ebc(colormethod, c) {
825 return srm_to_ebc(kw_to_srm(colormethod, c)); 826 return srm_to_ebc(kw_to_srm(colormethod,c));
826 } 827 }
827 828
828 829
829 830
830 /* 831 /*
1037 TotTme = 75; 1038 TotTme = 75;
1038 } 1039 }
1039 if (attenuation < 30) 1040 if (attenuation < 30)
1040 attenuation = 77; 1041 attenuation = 77;
1041 1042
1043 // 0.00825 Attenuation factor yeast
1044 // 0.00817 Attenuation factor water/grain ration
1045 // -0.00684 Attenuation factor mash temperature
1046 // 0.00026 Attenuation factor total mash time (at some places this is 0.0026 this is wrong!)
1047 // -0.00356 Attenuation factor percentage crystal malt
1048 // 0.00553 Attenuation factor percentage simple sugars
1049 // 0.547 Attenuation factor constant
1042 var AttBeer = 0.00825 * attenuation + 0.00817 * BD - 0.00684 * Temp + 0.00026 * TotTme - 0.00356 * percCara + 0.00553 * percSugar + 0.547; 1050 var AttBeer = 0.00825 * attenuation + 0.00817 * BD - 0.00684 * Temp + 0.00026 * TotTme - 0.00356 * percCara + 0.00553 * percSugar + 0.547;
1043 var fg = Math.round((1 + (1 - AttBeer) * (og - 1)) * 10000) / 10000; 1051 var fg = Math.round((1 + (1 - AttBeer) * (og - 1)) * 10000) / 10000;
1044 1052
1045 //console.log("estimate_fg("+percSugar+","+percCara+","+BD+","+TotTme+","+Temp+","+attenuation+","+og+") :"+fg); 1053 console.log("estimate_fg("+percSugar+","+percCara+","+BD+","+TotTme+","+Temp+","+attenuation+","+og+") AttBeer:"+AttBeer+" fg:"+fg);
1046 return fg; 1054 return fg;
1047 } 1055 }
1048 1056
1049 1057
1050 1058

mercurial