--- a/src/EditProductTab6.cpp Wed Jan 25 16:17:07 2023 +0100 +++ b/src/EditProductTab6.cpp Sat Jan 28 10:36:59 2023 +0100 @@ -209,7 +209,6 @@ bool maybe_starter = false; qDebug() << "calcYeast()"; - qDebug() << " " << product->prop_volume[0] << product->prop_volume[1] << product->prop_volume[2] << product->prop_volume[3]; ui->yeastProcedure->setCurrentIndex(0); if (sg <= 1.0001 && product->fg > 1.000) @@ -230,6 +229,12 @@ return; // No yeast in product. calcViability(); + double dry_amount = 0; + for (int i = 0; i < product->yeasts.size(); i++) { + if (product->yeasts.at(i).use == YEAST_USE_PRIMARY && product->yeasts.at(i).form == YEAST_FORMS_DRY) { + dry_amount += product->yeasts.at(i).amount; + } + } for (int i = 0; i < product->yeasts.size(); i++) { if (product->yeasts.at(i).use == YEAST_USE_PRIMARY) { // Primary @@ -250,15 +255,16 @@ qDebug() << " sg:" << sg << "og:" << og << "f1:" << f1 << "f2:" << f2 << "multiplier:" << multiplier; double yeast_grams = round(volume * multiplier * 100.0) / product->starter_viability; double yeast_gr_hl = round((yeast_grams / (volume * 0.01)) * 100.0) / 100.0; - double pitch_gr_hl = round(((product->yeasts.at(i).amount * 1000.0) / (volume * 0.01)) * 100.0) / 100.0; + double pitch_gr_hl = round(((dry_amount * 1000.0) / (volume * 0.01)) * 100.0) / 100.0; ui->dry_needShow->setValue(yeast_grams); ui->dry_pitchrateShow->setValue(yeast_gr_hl); ui->pitch_grShow->setValue(pitch_gr_hl); ui->pitch_grShow->setStyleSheet((pitch_gr_hl < yeast_gr_hl) ? "background-color: red":""); #ifdef DEBUG_YEAST - qDebug() << " need" << yeast_grams << "grams, gr/hl:" << yeast_gr_hl << "pitch:" << pitch_gr_hl; + qDebug() << " Need" << yeast_grams << "grams, gr/hl:" << yeast_gr_hl << "pitch:" << pitch_gr_hl; #endif + calcBU(); return; } else { /* @@ -284,6 +290,9 @@ } is_changed(); ui->pitchrateEdit->setValue(product->yeast_pitchrate); +#ifdef DEBUG_YEAST + qDebug() << " Guessed pitchrate" << product->yeast_pitchrate; +#endif } initcells = (product->yeasts.at(i).cells / 1000000) * product->yeasts.at(i).amount * (product->starter_viability / 100.0); @@ -297,7 +306,7 @@ } #ifdef DEBUG_YEAST - qDebug() << " pitchrate:" << product->yeast_pitchrate << "needed:" << needed << "initcells:" << initcells << "starter" << maybe_starter; + qDebug() << " Pitchrate:" << product->yeast_pitchrate << "needed:" << needed << "initcells:" << initcells << "starter" << maybe_starter; #endif } break; @@ -388,7 +397,7 @@ res.totcells = totcells; res.growf = round((ncells / start) * 100.0) / 100.0; #ifdef DEBUG_YEAST - qDebug() << " calcStep(" << svol << "," << stype << "," << start << ") irate" << irate + qDebug() << " calcStep(" << svol << "," << stype << "," << start << ") irate" << irate << "ncells" << res.ncells << "totcells" << res.totcells << "growf" << res.growf; #endif return res; @@ -431,8 +440,6 @@ return; for (step = 1; step < 5; step++) { - qDebug() << " step" << step; - for (i = lasti; i <= mvols; i++) { lasti = i; svol = uvols[lasti]; @@ -587,7 +594,12 @@ vpm = 0.80; max = 97; if (product->yeasts.at(i).laboratory == "White Labs") { // PurePitch - vpm = 0.95; + /* + * Purepitch 6th month viability point 80,8%. + * Purepitch Next Generation 6th month viability point 94,9%. + */ + vpm = 0.9648; // Purepitch + //vpm = 0.9914; // Purepitch Next Generation max = 100; } } else if (product->yeasts.at(i).form == YEAST_FORMS_DRY) { @@ -622,11 +634,10 @@ } if (base > max) base = max; - base = round(base); - product->starter_viability = base; + product->starter_viability = round(base * 10) / 10; ui->conditionShow->setValue(product->starter_viability); #ifdef DEBUG_YEAST - qDebug() << "age" << timeDiff << "degrade" << degrade << "base" << base ; + qDebug() << "age" << timeDiff << "degrade" << degrade << "viability" << product->starter_viability; #endif } @@ -899,7 +910,7 @@ return; product->yeasts.removeAt(row); - bool primary = false; + bool primary = false; /* Check if any primary yeast is left */ for (int i = 0; i < product->yeasts.size(); i++) { if (product->yeasts.at(i).use == YEAST_USE_PRIMARY) primary = true; @@ -936,7 +947,7 @@ item = new QTableWidgetItem(QString("%1 ml").arg(val, 3, 'f', 2, '0')); } item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); - ui->yeastsTable->setItem(product->yeasts_row, 9, item); + ui->yeastsTable->setItem(product->yeasts_row, 10, item); calcYeast(); is_changed(); @@ -1019,6 +1030,7 @@ yamountEdit->setDecimals(0); yamountEdit->setSingleStep(1.0); yamountLabel->setText(tr("Total packs:")); + product->yeast_pitchrate = 0; } else if ((product->yeasts.at(product->yeasts_row).form == YEAST_FORMS_DRY) || (product->yeasts.at(product->yeasts_row).form == YEAST_FORMS_DRIED)) { if (oldform == YEAST_FORMS_LIQUID) product->yeasts[product->yeasts_row].amount = 0.01; @@ -1033,6 +1045,7 @@ yamountEdit->setDecimals(1); yamountEdit->setSingleStep(0.5); yamountLabel->setText(tr("Amount in ml:")); + product->yeast_pitchrate = 0; } ui->yeastsTable->setItem(product->yeasts_row, 0, new QTableWidgetItem(product->yeasts.at(product->yeasts_row).name)); @@ -1100,7 +1113,6 @@ } is_changed(); - emit refreshAll(); } @@ -1139,9 +1151,8 @@ product->yeasts[product->yeasts_row].use = val; QTableWidgetItem *item = new QTableWidgetItem(QCoreApplication::translate("YeastUse", g_yeast_use[val])); item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); - ui->yeastsTable->setItem(product->yeasts_row, 5, item); + ui->yeastsTable->setItem(product->yeasts_row, 4, item); is_changed(); - emit refreshAll(); }