996 percSugar = 0; |
996 percSugar = 0; |
997 if (percCara > 50) |
997 if (percCara > 50) |
998 percCara = 0; |
998 percCara = 0; |
999 if ((WGratio > 0) && (TotTme > 0)) { |
999 if ((WGratio > 0) && (TotTme > 0)) { |
1000 BD = WGratio; |
1000 BD = WGratio; |
1001 BD = max(2, min(5.5, BD)); |
1001 if (BD < 2) |
1002 Temp = max(60, min(72, Temp)); |
1002 BD = 2; |
|
1003 if (BD > 5.5) |
|
1004 BD = 5.5; |
|
1005 if (Temp < 60) |
|
1006 Temp = 60; |
|
1007 if (Temp > 72) |
|
1008 Temp = 72; |
1003 } else { |
1009 } else { |
1004 BD = 3.5; |
1010 BD = 3.5; |
1005 Temp = 67; |
1011 Temp = 67; |
1006 TotTme = 75; |
1012 TotTme = 75; |
1007 } |
1013 } |
1008 if (attenuation < 30) |
1014 if (attenuation < 30) |
1009 attenuation = 77; |
1015 attenuation = 77; |
1010 |
1016 |
1011 var AttBeer = 0.00825 * attenuation + 0.00817 * BD - 0.00684 * Temp + 0.00026 * TotTme - 0.00356 * percCara + 0.00553 * percSugar + 0.547; |
1017 var AttBeer = 0.00825 * attenuation + 0.00817 * BD - 0.00684 * Temp + 0.00026 * TotTme - 0.00356 * percCara + 0.00553 * percSugar + 0.547; |
1012 var fg = Math.round((1 + (1 - AttBeer) * (og - 1)) * 1000) / 1000; |
1018 var fg = Math.round((1 + (1 - AttBeer) * (og - 1)) * 10000) / 10000; |
1013 |
1019 |
1014 console.log("estimate_fg("+percSugar+","+percCara+","+WGratio+","+TotTme+","+Temp+","+attenuation+","+og+") :"+fg); |
1020 //console.log("estimate_fg("+percSugar+","+percCara+","+BD+","+TotTme+","+Temp+","+attenuation+","+og+") :"+fg); |
1015 return fg; |
1021 return fg; |
1016 } |
1022 } |
1017 |
1023 |
1018 |
1024 |
1019 function CalcFrac(TpH, pK1, pK2, pK3) { |
1025 function CalcFrac(TpH, pK1, pK2, pK3) { |