src/Utils.cpp

changeset 344
9ffac162000c
parent 343
67e645b9d23f
child 350
37b3c690b02c
equal deleted inserted replaced
343:67e645b9d23f 344:9ffac162000c
419 ibu *= (1 + my_factor_cryohop / 100.0); 419 ibu *= (1 + my_factor_cryohop / 100.0);
420 } else if (Form == HOP_FORMS_EXTRACT) { 420 } else if (Form == HOP_FORMS_EXTRACT) {
421 // Nothing for now. 421 // Nothing for now.
422 } 422 }
423 423
424 qDebug() << "boilIBU" << Form << SG << Volume << Amount << T1 << T2 << Alpha << "IBU:" << ibu; 424 //qDebug() << "boilIBU" << Form << SG << Volume << Amount << T1 << T2 << Alpha << "IBU:" << ibu;
425 return ibu; 425 return ibu;
426 } 426 }
427 427
428 428
429 double Utils::toIBU(int Use, int Form, double SG, double Volume, double Amount, double Boiltime, double Alpha, 429 double Utils::toIBU(int Use, int Form, double SG, double Volume, double Amount, double Boiltime, double Alpha,
430 int Method, double Whirlpool9, double Whirlpool7, double Whirlpool6, double Fulltime, int Cooltype, double Coolparm1, double Coolparm2) 430 int Method, double Whirlpool9, double Whirlpool7, double Whirlpool6, double Fulltime, int Cooltype, double Coolparm1, double Coolparm2)
431 { 431 {
432 double loss_boiltemp = 1.0; /* Loss due to the lower boil temperature at higher altitude. */ 432 double ibu = 0.0;
433 433
434 double ibu = 0.0, whirlibus = 0.0; 434 if (Use == HOP_USEAT_MASH) {
435 double alpha = Alpha / 100.0; 435 /*
436 double mass = Amount * 1000.0; 436 * Mash hops. About -30% to -90% utilization. Is a global setting.
437 437 * They count for 60 minutes, this is a fixed value.
438 /* 438 * Almost all these hops will be gone after removing the malt. From
439 * IBU's from hops during Mash, FWH and boil. 439 * pellets there may be some dust left, but that has minor effects.
440 */ 440 *
441 if ((Use == HOP_USEAT_MASH) || (Use == HOP_USEAT_FWH) || (Use == HOP_USEAT_BOIL)) { 441 * http://scottjanish.com/the-locksmith-utilizing-bioengineered-yeast-and-high-bound-thiol-precersour-hops-and-phantasm-powder-to-thiol-drive-beer/
442 */
443 ibu = TinsethIBU(Form, SG, Volume, Amount, 0, 60, Alpha) * (1 + my_factor_mashhop / 100.0);
444
445 } else if ((Use == HOP_USEAT_FWH) || (Use == HOP_USEAT_BOIL)) {
446 /*
447 * IBU's from hops during FWH and boil.
448 */
442 double boil_time = Fulltime; 449 double boil_time = Fulltime;
443 if (Use == HOP_USEAT_BOIL) 450 if (Use == HOP_USEAT_BOIL)
444 boil_time = Boiltime; 451 boil_time = Boiltime;
445 ibu = TinsethIBU(Form, SG, Volume, Amount, 0, boil_time, Alpha); 452 ibu = TinsethIBU(Form, SG, Volume, Amount, 0, boil_time, Alpha);
446 453
447 /* 454 /*
448 * Corrections for Mash and FWH 455 * Corrections for Mash and FWH
449 */ 456 */
450 if (Use == HOP_USEAT_MASH) {
451 ibu *= (1 + my_factor_mashhop / 100.0);
452 }
453 if (Use == HOP_USEAT_FWH) { 457 if (Use == HOP_USEAT_FWH) {
454 ibu *= (1 + my_factor_fwh / 100.0); 458 ibu *= (1 + my_factor_fwh / 100.0);
455 } 459 }
456 460
457 if (Method > 0) { 461 if (Method > 0) {
458 double nibu = ibu; 462 double nibu = ibu;
459 loss_boiltemp = IBU_reduction(boilPoint()); 463 nibu *= IBU_reduction(boilPoint());
460 nibu *= loss_boiltemp;
461 qDebug() << "ibu" << nibu << "loss_boiltemp" << loss_boiltemp;
462 464
463 /* 465 /*
464 * Flameout, currently fixed 1 minute. 466 * Flameout, currently fixed 1 minute.
465 */ 467 */
466 double flameout_time = 1; 468 double flameout_time = 1;
467 double fibu = TinsethIBU(Form, SG, Volume, Amount, boil_time, boil_time + flameout_time, Alpha); 469 double fibu = TinsethIBU(Form, SG, Volume, Amount, boil_time, boil_time + flameout_time, Alpha);
468 fibu *= IBU_reduction(98.0); 470 fibu *= IBU_reduction(98.0);
469 qDebug() << "during flameout" << fibu; 471 //qDebug() << "during flameout" << fibu;
470 nibu += fibu; 472 nibu += fibu;
471 473
472 // Add this hop during cooling 474 // Add this hop during cooling
473 /* 475 /*
474 * Hopstands, this boil hop adds some IBU's too. 476 * Hopstands, this boil hop adds some IBU's too.
489 double wibu6 = TinsethIBU(Form, SG, Volume, Amount, boil_time + flameout_time, boil_time + flameout_time + Whirlpool6, Alpha); 491 double wibu6 = TinsethIBU(Form, SG, Volume, Amount, boil_time + flameout_time, boil_time + flameout_time + Whirlpool6, Alpha);
490 wibu6 *= IBU_reduction(63.0); 492 wibu6 *= IBU_reduction(63.0);
491 //qDebug() << "during whirlpool6" << wibu6; 493 //qDebug() << "during whirlpool6" << wibu6;
492 nibu += wibu6; 494 nibu += wibu6;
493 } 495 }
494 qDebug() << "Old IBU" << ibu << "New IBU" << nibu; 496 //qDebug() << "Old IBU" << ibu << "New IBU" << nibu;
495 ibu = nibu; 497 ibu = nibu;
496 } 498 }
497 499
498 } else if ((Use == HOP_USEAT_AROMA) && (Method > 0)) { 500 } else if ((Use == HOP_USEAT_AROMA) && (Method > 0)) {
499 /* 501 /*
546 //qDebug() << "during whirlpool6" << wibu6; 548 //qDebug() << "during whirlpool6" << wibu6;
547 ibu = wibu6; 549 ibu = wibu6;
548 } 550 }
549 } 551 }
550 552
551 double rc = round((ibu + whirlibus) * 100.0) / 100.0; 553 double rc = round(ibu * 1000.0) / 1000.0;
552 554
553 qDebug() << "toIBU" << Use << Form << SG << Volume << Amount << Boiltime << Alpha << Method << Whirlpool9 << Whirlpool7 << Whirlpool6 << Fulltime << Cooltype << Coolparm1 << Coolparm2 << "rc:" << rc; 555 qDebug() << "toIBU" << Use << Form << SG << Volume << Amount << Boiltime << Alpha << Method << Whirlpool9 << Whirlpool7 << Whirlpool6 << Fulltime << Cooltype << Coolparm1 << Coolparm2 << "rc:" << rc;
554 return rc; 556 return rc;
555 } 557 }
556 558

mercurial