Fixed whirlpool and flameout hops bitterness calculations. Fixed toIBU parameters in the recipe part, missing whirlpool times.

Tue, 17 May 2022 20:45:08 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Tue, 17 May 2022 20:45:08 +0200
changeset 215
4e2de71142a4
parent 214
641540dc6ef2
child 216
39aad77b7599

Fixed whirlpool and flameout hops bitterness calculations. Fixed toIBU parameters in the recipe part, missing whirlpool times.

src/EditProductTab4.cpp file | annotate | diff | comparison | revisions
src/Utils.cpp file | annotate | diff | comparison | revisions
--- 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'));
--- 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));
 	}
     }
 

mercurial