772 return kt; |
772 return kt; |
773 } |
773 } |
774 |
774 |
775 |
775 |
776 |
776 |
777 /* |
|
778 * Alcohol By Volume |
|
779 */ |
|
780 function abvol(og,fg){ |
777 function abvol(og,fg){ |
781 |
778 if(((og-fg)<0)||(fg<0.9))return 0; |
782 if(((og-fg)<0)||(fg<0.9)) |
779 var factor=og*3157*Math.pow(10,-5)+9.716*Math.pow(10,-2); |
783 return 0; |
780 return (og*1000-fg*1000)*factor; |
784 |
|
785 /* |
|
786 * Formule van Hans Halberstadt. De constante factor is afhankelijk van de |
|
787 * zwaarte van het wort. |
|
788 */ |
|
789 var factor=og*3157*Math.pow(10,-5)+9.716*Math.pow(10,-2); |
|
790 return (og*1000-fg*1000)*factor; |
|
791 |
|
792 /* |
|
793 * Dit lijkt goed en wordt in veel moderne software gebruikt, maar... |
|
794 * dit klopt niet. Busted door Hans Halberstadt. |
|
795 * return (76.08 * (og-fg) / (1.775-og)) * (fg / 0.794); // Daniels |
|
796 */ |
|
797 |
|
798 /* |
|
799 * Brouwhulp, houdt geen rekening met zwaardere bieren. |
|
800 * if ((4.749804 - fg) != 0) |
|
801 * return 486.8693 * (og - fg) / (4.749804 - fg); |
|
802 */ |
|
803 } |
781 } |
804 |
782 |
805 |
783 |
806 |
784 |
807 /* |
785 /* |
972 return result; |
950 return result; |
973 } |
951 } |
974 |
952 |
975 |
953 |
976 |
954 |
977 function sg_to_plato(sg) { |
955 function sg_to_plato(sg){return ((135.997*sg-630.272)*sg+1111.14)*sg-616.868;} |
978 // http://www.brewersfriend.com/2012/10/31/on-the-relationship-between-plato-and-specific-gravity/ |
956 function plato_to_sg(plato){return 1+(plato/(258.6-((plato/258.2)*227.1)));} |
979 return ((135.997 * sg - 630.272) * sg + 1111.14) * sg - 616.868; |
957 function brix_to_sg(brix){return plato_to_sg(brix/my_brix_correction);} |
980 } |
958 function sg_to_brix(sg){return sg_to_plato(sg)*my_brix_correction;} |
981 |
959 |
982 |
960 |
983 |
961 |
984 function plato_to_sg(plato) { |
962 function estimate_sg(sugars,batch_size){ |
985 return 1 + (plato / (258.6 - ((plato / 258.2) * 227.1))); |
|
986 } |
|
987 |
|
988 |
|
989 |
|
990 function brix_to_sg(brix) { |
|
991 return plato_to_sg(brix / my_brix_correction); |
|
992 } |
|
993 |
|
994 |
|
995 |
|
996 function sg_to_brix(sg) { |
|
997 return sg_to_plato(sg) * my_brix_correction; |
|
998 } |
|
999 |
|
1000 |
|
1001 |
|
1002 function estimate_sg(sugars, batch_size) { |
|
1003 var plato = 100 * sugars / batch_size; |
963 var plato = 100 * sugars / batch_size; |
1004 |
|
1005 var sg = plato_to_sg(plato); |
964 var sg = plato_to_sg(plato); |
1006 for (var i = 0; i < 20; i++) { |
965 for (var i = 0; i < 20; i++) { |
1007 if (sg > 0) |
966 if (sg > 0) |
1008 plato = 100 * sugars / (batch_size * sg); |
967 plato = 100 * sugars / (batch_size * sg); |
1009 sg = plato_to_sg(plato); |
968 sg = plato_to_sg(plato); |
1010 } |
969 } |
1011 // console.log("estimate_sg(" + sugars + "," + batch_size + ") : " + sg); |
970 return Math.round(sg * 10000) / 10000; |
1012 return sg; |
|
1013 } |
971 } |
1014 |
972 |
1015 |
973 |
1016 |
974 |
1017 function estimate_fg(percSugar, percCara, WGratio, TotTme, Temp, attenuation, og) { |
975 function estimate_fg(percSugar, percCara, WGratio, TotTme, Temp, attenuation, og) { |