# HG changeset patch # User Michiel Broek # Date 1652813108 -7200 # Node ID 4e2de71142a4da82e82296bea3b06193f6f03bea # Parent 641540dc6ef23753ba46643576c925a4ee54ac49 Fixed whirlpool and flameout hops bitterness calculations. Fixed toIBU parameters in the recipe part, missing whirlpool times. diff -r 641540dc6ef2 -r 4e2de71142a4 src/EditProductTab4.cpp --- a/src/EditProductTab4.cpp Tue May 17 16:57:48 2022 +0200 +++ b/src/EditProductTab4.cpp Tue May 17 20:45:08 2022 +0200 @@ -98,7 +98,7 @@ double ibu = Utils::toIBU(product->hops.at(i).h_useat, product->hops.at(i).h_form, product->preboil_sg, product->batch_size, product->hops.at(i).h_amount, product->hops.at(i).h_time, product->hops.at(i).h_alpha, product->ibu_method, - 0, product->hops.at(i).h_time, 0, product->boil_time); + product->brew_whirlpool9, product->brew_whirlpool7, product->brew_whirlpool6, product->boil_time); item = new QTableWidgetItem(QString("%1").arg(ibu, 2, 'f', 1, '0')); item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); ui->hopsTable->setItem(i, 7, item); @@ -300,8 +300,8 @@ double ibu = Utils::toIBU(product->hops.at(product->hops_row).h_useat, product->hops.at(product->hops_row).h_form, product->preboil_sg, product->batch_size, product->hops.at(product->hops_row).h_amount, product->hops.at(product->hops_row).h_time, - product->hops.at(product->hops_row).h_alpha, product->ibu_method, 0, product->hops.at(product->hops_row).h_time, 0, - product->boil_time); + product->hops.at(product->hops_row).h_alpha, product->ibu_method, + product->brew_whirlpool9, product->brew_whirlpool7, product->brew_whirlpool6, product->boil_time); ibuEdit->setValue(ibu); item = new QTableWidgetItem(QString("%1").arg(ibu, 2, 'f', 1, '0')); diff -r 641540dc6ef2 -r 4e2de71142a4 src/Utils.cpp --- a/src/Utils.cpp Tue May 17 16:57:48 2022 +0200 +++ b/src/Utils.cpp Tue May 17 20:45:08 2022 +0200 @@ -375,30 +375,28 @@ // Ideas from Zymurgy March-April 2018. These are not exact formulas! double whirlibus = 0.0; - if (Use == HOP_USEAT_AROMA || Use == HOP_USEAT_WHIRLPOOL) { // Flameout or any whirlpool - + if (Use == HOP_USEAT_AROMA) { + if (Whirlpool9) { // Flameout hops are 2 minutes in this range. + whirlibus += (alpha * mass * 20) / liters * (2.0 / 50.0); + } + if (Whirlpool7) { // Flameout hops are 4 minutes in this range. + whirlibus += (alpha * mass * 6) / liters * (4.0 / 50.0); + } + } + if (Use == HOP_USEAT_WHIRLPOOL) { // Flameout or any whirlpool if (Whirlpool9) { // 20 mg/l/50 min whirlibus += (alpha * mass * 20) / liters * (Whirlpool9 / 50.0); - qDebug() << "Whirlpool9" << alpha * mass * 20 << " liter:" << liters << " time:" << Whirlpool9 << " ibu" << (alpha * mass * 20) / liters * (Whirlpool9 / 50.0); - } else { - if (Use == 3) { // Flameout hops are 2 minutes in this range. - whirlibus += (alpha * mass * 20) / liters * (2.0 / 50.0); - } + //qDebug() << "Whirlpool9" << alpha * mass * 20 << " liter:" << liters << " time:" << Whirlpool9 << " ibu" << (alpha * mass * 20) / liters * (Whirlpool9 / 50.0); } if (Whirlpool7) { // 6 mg/l/50 min whirlibus += (alpha * mass * 6) / liters * (Whirlpool7 / 50.0); - qDebug() << "Whirlpool7" << alpha * mass * 6 << " liter:" << liters << " time:" << Whirlpool7 << " ibu" << (alpha * mass * 6) / liters * (Whirlpool7 / 50.0); - } else { - if (Use == 3) { // Flameout hops are 4 minutes in this range. - whirlibus += (alpha * mass * 6) / liters * (4.0 / 50.0); - } + //qDebug() << "Whirlpool7" << alpha * mass * 6 << " liter:" << liters << " time:" << Whirlpool7 << " ibu" << (alpha * mass * 6) / liters * (Whirlpool7 / 50.0); } if (Whirlpool6) { // 2 mg/l/50 min whirlibus += (alpha * mass * 2) / liters * (Whirlpool6 / 50.0); - //console.log('Whirlpool6:' + alpha * mass * 2 + ' liter:' + liters + ' time:' + Whirlpool6 + ' ibu' + (alpha * mass * 2) / liters * (Whirlpool6 / 50)); } }