src/Utils.cpp

changeset 450
d4cff87ea156
parent 449
00757c056ca6
child 452
c4c5d02131be
equal deleted inserted replaced
449:00757c056ca6 450:d4cff87ea156
283 283
284 284
285 double Utils::estimate_fg(double psugar, double pcara, double wgratio, double mashtime, double mashtemp, double svg, double og, bool sta1) 285 double Utils::estimate_fg(double psugar, double pcara, double wgratio, double mashtime, double mashtemp, double svg, double og, bool sta1)
286 { 286 {
287 double BD; 287 double BD;
288 double att_mashtemp;
288 289
289 if (psugar > 40) 290 if (psugar > 40)
290 psugar = 0; 291 psugar = 0;
291 if (pcara > 50) 292 if (pcara > 50)
292 pcara = 0; 293 pcara = 0;
295 BD = wgratio; 296 BD = wgratio;
296 if (BD < 2) 297 if (BD < 2)
297 BD = 2; 298 BD = 2;
298 if (BD > 5.5) 299 if (BD > 5.5)
299 BD = 5.5; 300 BD = 5.5;
300 if (mashtemp < 60)
301 mashtemp = 60;
302 if (mashtemp > 72)
303 mashtemp = 72;
304 } else { 301 } else {
305 BD = 3.5; 302 BD = 3.5;
306 mashtemp = 67; 303 mashtemp = 67;
307 mashtime = 75; 304 mashtime = 75;
308 } 305 }
318 * -0.00356 Attenuation factor percentage crystal malt 315 * -0.00356 Attenuation factor percentage crystal malt
319 * 0.00553 Attenuation factor percentage simple sugars 316 * 0.00553 Attenuation factor percentage simple sugars
320 * 0.547 Attenuation factor constant 317 * 0.547 Attenuation factor constant
321 * 0.597 Attenuation factor constant when STA1 gen is true. 318 * 0.597 Attenuation factor constant when STA1 gen is true.
322 */ 319 */
323 double AttBeer = 0.00825 * svg + 0.00817 * BD - 0.00684 * mashtemp + 0.00026 * mashtime - 0.00356 * pcara + 0.00553 * psugar; 320 double top_mashtemp = 66.11; /* Highest fermentable at 151 degrees fahrenheit */
321 /*
322 * Derived from Karl Troester's data and Matt Kahn.
323 */
324 if (mashtemp > top_mashtemp) {
325 /* Above optimum mash temperature decrease attenuation */
326 att_mashtemp = - 0.00684 * mashtemp;
327 } else {
328 /* Below optimum mash temperature decrease slowly attenuation */
329 att_mashtemp = - 0.00684 * (top_mashtemp + (top_mashtemp - mashtemp) / 4);
330 }
331
332 double AttBeer = 0.00825 * svg + 0.00817 * BD + att_mashtemp + 0.00026 * mashtime - 0.00356 * pcara + 0.00553 * psugar;
324 AttBeer += (sta1) ? 0.597:0.547; 333 AttBeer += (sta1) ? 0.597:0.547;
325 qDebug() << "estimate_fg(" << psugar << pcara << wgratio << mashtime << mashtemp << svg << og << sta1 << ") AttBeer:" << AttBeer; 334 qDebug() << "estimate_fg(" << psugar << pcara << wgratio << mashtime << mashtemp << svg << og << sta1 << ") AttBeer:" << AttBeer;
326 return round((1 + (1 - AttBeer) * (og -1)) * 10000) / 10000; 335 return round((1 + (1 - AttBeer) * (og -1)) * 10000) / 10000;
327 } 336 }
328 337

mercurial