www/js/global.js

changeset 136
bcc4583fd013
parent 133
22d28dd9c041
child 139
eb1ac7487710
equal deleted inserted replaced
135:cd1403633e96 136:bcc4583fd013
233 // console.log("estimate_sg(" + sugars + "," + batch_size + ") : " + sg); 233 // console.log("estimate_sg(" + sugars + "," + batch_size + ") : " + sg);
234 return sg; 234 return sg;
235 } 235 }
236 236
237 237
238
239 function estimate_fg(percSugar, percCara, WGratio, TotTme, Temp, attenuation, og) {
240
241 var BD;
242
243 console.log("estimate_fg("+percSugar+","+percCara+","+WGratio+","+TotTme+","+Temp+","+attenuation+","+og+")");
244
245 if (percSugar > 40)
246 percSugar = 0;
247 if (percCara > 50)
248 percCara = 0;
249 if ((WGratio > 0) && (TotTme > 0)) {
250 BD = WGratio;
251 BD = max(2, min(5.5, BD));
252 Temp = max(60, min(72, Temp));
253 } else {
254 BD = 3.5;
255 Temp = 67;
256 TotTme = 75;
257 }
258 if (attenuation < 30)
259 attenuation = 77;
260
261 var AttBeer = 0.00825 * attenuation + 0.00817 * BD - 0.00684 * Temp + 0.00026 * TotTme - 0.00356 * percCara + 0.00553 * percSugar + 0.547;
262 var fg = Math.round((1 + (1 - AttBeer) * (og - 1)) * 1000) / 1000;
263 console.log("fg:"+fg);
264 return fg;
265 }
266
267
238 /* 268 /*
239 * Steinie: 269 * Steinie:
240 * 270 *
241 * 271 *
242 * HCO3 = CaCo3 x 1,22 272 * HCO3 = CaCo3 x 1,22

mercurial