Setting mash hopping efficiency now between -95 and +50. Refresh all after changing the IBU method. Added own part for Mash Hopping. Code cleanup.

Fri, 08 Jul 2022 15:33:27 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Fri, 08 Jul 2022 15:33:27 +0200
changeset 344
9ffac162000c
parent 343
67e645b9d23f
child 345
e4f1769047db

Setting mash hopping efficiency now between -95 and +50. Refresh all after changing the IBU method. Added own part for Mash Hopping. Code cleanup.

src/EditProductTab1.cpp file | annotate | diff | comparison | revisions
src/Setup.cpp file | annotate | diff | comparison | revisions
src/Utils.cpp file | annotate | diff | comparison | revisions
--- a/src/EditProductTab1.cpp	Fri Jul 08 13:24:45 2022 +0200
+++ b/src/EditProductTab1.cpp	Fri Jul 08 15:33:27 2022 +0200
@@ -105,6 +105,7 @@
     product->ibu_method = val;
     calcIBUs();
     is_changed();
+    emit refreshAll();
 }
 
 
--- a/src/Setup.cpp	Fri Jul 08 13:24:45 2022 +0200
+++ b/src/Setup.cpp	Fri Jul 08 15:33:27 2022 +0200
@@ -102,7 +102,7 @@
     mashhopEdit->setGeometry(QRect(210, 150, 81, 24));
     mashhopEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
     mashhopEdit->setAccelerated(true);
-    mashhopEdit->setMinimum(-50);
+    mashhopEdit->setMinimum(-95);
     mashhopEdit->setMaximum(50);
     mashhopEdit->setToolTip(tr("The efficiency for Mash hopping."));
     mashhopEdit->setSuffix(tr("%"));
--- a/src/Utils.cpp	Fri Jul 08 13:24:45 2022 +0200
+++ b/src/Utils.cpp	Fri Jul 08 15:33:27 2022 +0200
@@ -421,7 +421,7 @@
 	// Nothing for now.
     }
 
-    qDebug() << "boilIBU" << Form << SG << Volume << Amount << T1 << T2 << Alpha << "IBU:" << ibu;
+    //qDebug() << "boilIBU" << Form << SG << Volume << Amount << T1 << T2 << Alpha << "IBU:" << ibu;
     return ibu;
 }
 
@@ -429,16 +429,23 @@
 double Utils::toIBU(int Use, int Form, double SG, double Volume, double Amount, double Boiltime, double Alpha,
 		    int Method, double Whirlpool9, double Whirlpool7, double Whirlpool6, double Fulltime, int Cooltype, double Coolparm1, double Coolparm2)
 {
-    double loss_boiltemp = 1.0;		/* Loss due to the lower boil temperature at higher altitude.	*/
+    double ibu = 0.0;
 
-    double ibu = 0.0, whirlibus = 0.0;
-    double alpha = Alpha / 100.0;
-    double mass = Amount * 1000.0;
+    if (Use == HOP_USEAT_MASH) {
+	/*
+	 * Mash hops. About -30% to -90% utilization. Is a global setting.
+	 * They count for 60 minutes, this is a fixed value.
+	 * Almost all these hops will be gone after removing the malt. From
+	 * pellets there may be some dust left, but that has minor effects.
+	 *
+	 * http://scottjanish.com/the-locksmith-utilizing-bioengineered-yeast-and-high-bound-thiol-precersour-hops-and-phantasm-powder-to-thiol-drive-beer/
+	 */
+	ibu = TinsethIBU(Form, SG, Volume, Amount, 0, 60, Alpha) * (1 + my_factor_mashhop / 100.0);
 
-    /*
-     * IBU's from hops during Mash, FWH and boil.
-     */
-    if ((Use == HOP_USEAT_MASH) || (Use == HOP_USEAT_FWH) || (Use == HOP_USEAT_BOIL)) {
+    } else if ((Use == HOP_USEAT_FWH) || (Use == HOP_USEAT_BOIL)) {
+	/*
+	 * IBU's from hops during FWH and boil.
+	 */
 	double boil_time = Fulltime;
 	if (Use == HOP_USEAT_BOIL)
 	    boil_time = Boiltime;
@@ -447,18 +454,13 @@
 	/*
 	 * Corrections for Mash and FWH
 	 */
-	if (Use == HOP_USEAT_MASH) {
-	    ibu *= (1 + my_factor_mashhop / 100.0);
-	}
 	if (Use == HOP_USEAT_FWH) {
             ibu *= (1 + my_factor_fwh / 100.0);
 	}
 
 	if (Method > 0) {
 	    double nibu = ibu;
-	    loss_boiltemp = IBU_reduction(boilPoint());
-	    nibu *= loss_boiltemp;
-	    qDebug() << "ibu" << nibu << "loss_boiltemp" << loss_boiltemp;
+	    nibu *= IBU_reduction(boilPoint());
 
 	    /*
 	     * Flameout, currently fixed 1 minute.
@@ -466,7 +468,7 @@
 	    double flameout_time = 1;
 	    double fibu = TinsethIBU(Form, SG, Volume, Amount, boil_time, boil_time + flameout_time, Alpha);
 	    fibu *= IBU_reduction(98.0);
-	    qDebug() << "during flameout" << fibu;
+	    //qDebug() << "during flameout" << fibu;
 	    nibu += fibu;
 
 	    // Add this hop during cooling
@@ -491,7 +493,7 @@
                 //qDebug() << "during whirlpool6" << wibu6;
                 nibu += wibu6;
             }
-	    qDebug() << "Old IBU" << ibu << "New IBU" << nibu;
+	    //qDebug() << "Old IBU" << ibu << "New IBU" << nibu;
 	    ibu = nibu;
 	}
 
@@ -548,7 +550,7 @@
         }
     }
 
-    double rc = round((ibu + whirlibus) * 100.0) / 100.0;
+    double rc = round(ibu * 1000.0) / 1000.0;
 
     qDebug() << "toIBU" << Use << Form << SG << Volume << Amount << Boiltime << Alpha << Method << Whirlpool9 << Whirlpool7 << Whirlpool6 << Fulltime << Cooltype << Coolparm1 << Coolparm2 << "rc:" << rc;
     return rc;

mercurial