# HG changeset patch # User Michiel Broek # Date 1673189596 -3600 # Node ID 00757c056ca69522bc92b5c36cfb17df412a6c2a # Parent 9e0da3824cf93817031e3cf980fff24a843126cf With estimate_fg added a boolean parameter sta1 to correct the outcome if a primary yeast with sta1 gen is used. Fixed a spelling error in EditProduct yeast tab for dry yeast. diff -r 9e0da3824cf9 -r 00757c056ca6 src/EditProductTab3.cpp --- a/src/EditProductTab3.cpp Sat Dec 03 16:32:24 2022 +0100 +++ b/src/EditProductTab3.cpp Sun Jan 08 15:53:16 2023 +0100 @@ -491,12 +491,15 @@ */ double svg = 0; double initcells = 0; + bool sta1 = false; product->yeasts_ok = true; if (product->yeasts.size() > 0) { for (i = 0; i < product->yeasts.size(); i++) { if (product->yeasts.at(i).use == 0) { // Used in primary if (product->yeasts.at(i).attenuation > svg) svg = product->yeasts.at(i).attenuation; // Take the highest if multiple yeasts. + if (product->yeasts.at(i).sta1) + sta1 = true; } if (product->yeasts.at(i).form == 0) initcells += (product->yeasts.at(i).cells / 1000000000) * product->yeasts.at(i).amount * (product->starter_viability / 100); @@ -518,9 +521,9 @@ ui->est_svgEdit->setValue(svg); if (product->mashs_kg > 0 && mashinfuse > 0 && mashtime > 0 && mashtemp > 0) - product->est_fg = Utils::estimate_fg(psugar, pcara, mashinfuse / product->mashs_kg, mashtime, mashtemp, svg, product->est_og); + product->est_fg = Utils::estimate_fg(psugar, pcara, mashinfuse / product->mashs_kg, mashtime, mashtemp, svg, product->est_og, sta1); else - product->est_fg = Utils::estimate_fg(psugar, pcara, 0, 0, 0, svg, product->est_og); + product->est_fg = Utils::estimate_fg(psugar, pcara, 0, 0, 0, svg, product->est_og, sta1); qDebug() << " est FG" << ui->est_fgEdit->value() << product->est_fg; product->est_abv = Utils::abvol(product->est_og, product->est_fg); // qDebug() << " est ABV" << ui->est_abvEdit->value() << product->est_abv; diff -r 9e0da3824cf9 -r 00757c056ca6 src/EditRecipeTab2.cpp --- a/src/EditRecipeTab2.cpp Sat Dec 03 16:32:24 2022 +0100 +++ b/src/EditRecipeTab2.cpp Sun Jan 08 15:53:16 2023 +0100 @@ -307,11 +307,14 @@ * Calculate the apparant attenuation. */ double svg = 0; + bool sta1 = false; if (recipe->yeasts.size() > 0) { for (i = 0; i < recipe->yeasts.size(); i++) { if (recipe->yeasts.at(i).use == 0) { // Used in primary if (recipe->yeasts.at(i).attenuation > svg) svg = recipe->yeasts.at(i).attenuation; // Take the highest if multiple yeasts. + if (recipe->yeasts.at(i).sta1) + sta1 = true; } // TODO: brett or others in secondary. } @@ -323,9 +326,9 @@ double fg; if (recipe->mashs_kg > 0 && mashinfuse > 0 && mashtime > 0 && mashtemp > 0) - fg = Utils::estimate_fg(psugar, pcara, mashinfuse / recipe->mashs_kg, mashtime, mashtemp, svg, og); + fg = Utils::estimate_fg(psugar, pcara, mashinfuse / recipe->mashs_kg, mashtime, mashtemp, svg, og, sta1); else - fg = Utils::estimate_fg(psugar, pcara, 0, 0, 0, svg, og); + fg = Utils::estimate_fg(psugar, pcara, 0, 0, 0, svg, og, sta1); qDebug() << " FG" << ui->est_fgEdit->value() << fg; recipe->est_fg = fg; ui->est_fgEdit->setValue(fg); diff -r 9e0da3824cf9 -r 00757c056ca6 src/Utils.cpp --- a/src/Utils.cpp Sat Dec 03 16:32:24 2022 +0100 +++ b/src/Utils.cpp Sun Jan 08 15:53:16 2023 +0100 @@ -282,7 +282,7 @@ } -double Utils::estimate_fg(double psugar, double pcara, double wgratio, double mashtime, double mashtemp, double svg, double og) +double Utils::estimate_fg(double psugar, double pcara, double wgratio, double mashtime, double mashtemp, double svg, double og, bool sta1) { double BD; @@ -310,16 +310,19 @@ svg = 77; /* - * From brouwhulp: - * 0.00825 Attenuation factor yeast + * Original from brouwhulp: + * 0.00825 Attenuation factor yeast (Real to apparant ??) * 0.00817 Attenuation factor water/grain ratio * -0.00684 Attenuation factor mash temperature - * 0.00026 Attenuation factor total mash time (at some places this is 0.0026 this is wrong!) + * 0.00026 Attenuation factor total mash time * -0.00356 Attenuation factor percentage crystal malt * 0.00553 Attenuation factor percentage simple sugars * 0.547 Attenuation factor constant + * 0.597 Attenuation factor constant when STA1 gen is true. */ - double AttBeer = 0.00825 * svg + 0.00817 * BD - 0.00684 * mashtemp + 0.00026 * mashtime - 0.00356 * pcara + 0.00553 * psugar + 0.547; + double AttBeer = 0.00825 * svg + 0.00817 * BD - 0.00684 * mashtemp + 0.00026 * mashtime - 0.00356 * pcara + 0.00553 * psugar; + AttBeer += (sta1) ? 0.597:0.547; + qDebug() << "estimate_fg(" << psugar << pcara << wgratio << mashtime << mashtemp << svg << og << sta1 << ") AttBeer:" << AttBeer; return round((1 + (1 - AttBeer) * (og -1)) * 10000) / 10000; } diff -r 9e0da3824cf9 -r 00757c056ca6 src/Utils.h --- a/src/Utils.h Sat Dec 03 16:32:24 2022 +0100 +++ b/src/Utils.h Sun Jan 08 15:53:16 2023 +0100 @@ -27,7 +27,20 @@ double brix_to_fg(double o_plato, double refracto); double calc_svg(double og, double fg); double estimate_sg(double sugars, double batch_size); - double estimate_fg(double psugar, double pcara, double wgratio, double mashtime, double mashtemp, double svg, double og); + + /** + * @brief Predict FG using recipe data. + * @param psugar Percentage sugar in the wort. + * @param pcara Percentage cara/crystal malts in the wort. + * @param wgratio The water/grain ratio of the mash. + * @param mashtime The total mash time in minutes. + * @param mashtemp The average mash temperature. + * @param svg The SVG percentage of the primary yeast. + * @param og The Original Gravity of the wort. + * @param sta1 The STA1 gen present in the yeast flag. + * @return The predicted Final Gravity. + */ + double estimate_fg(double psugar, double pcara, double wgratio, double mashtime, double mashtemp, double svg, double og, bool sta1); double kw_to_srm(int colormethod, double c); double kw_to_ebc(int colormethod, double c); double kw_to_newebc(int colormethod, double c); diff -r 9e0da3824cf9 -r 00757c056ca6 translations/bmsapp_en.ts --- a/translations/bmsapp_en.ts Sat Dec 03 16:32:24 2022 +0100 +++ b/translations/bmsapp_en.ts Sun Jan 08 15:53:16 2023 +0100 @@ -2661,6 +2661,11 @@ + + Dry yeast calculation. + + + Top up water: @@ -2909,11 +2914,6 @@ - - Dry yeast claculation. - - - Low grams/hl: @@ -2983,7 +2983,7 @@ - + Mash @@ -4207,22 +4207,22 @@ - + Final FG: - + Final ABV: - + Delete fermentable - + @@ -4232,46 +4232,46 @@ - + Current ingredient: - + Supplier: - + Amount in kg: - + Percentage in batch: - + Auto fill to 100%: - + Use at: - + Select ingredient: - + @@ -4279,23 +4279,23 @@ - + Max in batch: - + Boil - + Fermentation - + Lagering @@ -4375,7 +4375,7 @@ - + Final IBU: @@ -4856,22 +4856,22 @@ - + Package ABV %: - + Final ABV %: - + Confirm package - + Confirm that the beer is packaged and all data is correct @@ -6196,7 +6196,7 @@ - + Mash @@ -6732,12 +6732,12 @@ - + Delete fermentable - + @@ -6747,46 +6747,46 @@ - + Current ingredient: - + Supplier: - + Amount in kg: - + Percentage in batch: - + Auto fill to 100%: - + Use at: - + Select ingredient: - + @@ -6794,35 +6794,35 @@ - + Max in batch: - - - - Boil - - - - - Fermentation - - - - - Lagering - - - - - Bottle + + + Boil + Fermentation + + + + + Lagering + + + + + + Bottle + + + + Kegs diff -r 9e0da3824cf9 -r 00757c056ca6 translations/bmsapp_nl.ts --- a/translations/bmsapp_nl.ts Sat Dec 03 16:32:24 2022 +0100 +++ b/translations/bmsapp_nl.ts Sun Jan 08 15:53:16 2023 +0100 @@ -3006,9 +3006,8 @@ Nodig miljard cellen: - Dry yeast claculation. - Droge gist berekening. + Droge gist berekening. @@ -3080,7 +3079,7 @@ - + Mash Maischen @@ -3579,7 +3578,7 @@ Toevoeging opmerking: - + Final ABV %: Finale ABV %: @@ -3991,7 +3990,7 @@ Verpakken volume: - + Package ABV %: Verpakken ABV %: @@ -4139,6 +4138,11 @@ Schijnbare vergisting: + + Dry yeast calculation. + Droge gist berekening. + + Acid Additions Zuur toevoegingen @@ -4599,12 +4603,12 @@ Finale EBC: - + Final FG: Finale FG: - + Final ABV: Finale ABV: @@ -4621,12 +4625,12 @@ Finale FG: - + Delete fermentable Verwijder vergistbaar ingredient - + @@ -4636,46 +4640,46 @@ Verwijder %1 - + Current ingredient: Huidig ingredient: - + Supplier: Leverancier: - + Amount in kg: Gewicht in kg: - + Percentage in batch: Percentage in stort: - + Auto fill to 100%: Aanvullen tot 100%: - + Use at: Toevoegen bij: - + Select ingredient: Kies ingredient: - + @@ -4683,23 +4687,23 @@ In voorraad: - + Max in batch: Max. in stort: - + Boil Koken - + Fermentation Hoofdvergisting - + Lagering Nagisting/lagering @@ -4779,7 +4783,7 @@ - + Final IBU: Finale IBU: @@ -5560,12 +5564,12 @@ Finale IBU:x - + Confirm package Bevestig verpakken - + Confirm that the beer is packaged and all data is correct Bevestig dat het bier verpakt is en de gegevens kloppen @@ -6711,7 +6715,7 @@ - + Mash @@ -7355,12 +7359,12 @@ Wijzig - + Delete fermentable Verwijder vergistbaar ingredient - + @@ -7370,46 +7374,46 @@ Verwijder %1 - + Current ingredient: Huidig ingredient: - + Supplier: Leverancier: - + Amount in kg: Gewicht in kg: - + Percentage in batch: Percentage in stort: - + Auto fill to 100%: Aanvullen tot 100%: - + Use at: Toevoegen bij: - + Select ingredient: Kies ingredient: - + @@ -7417,35 +7421,35 @@ In voorraad: - + Max in batch: Max. in stort: - + Boil Koken - + Fermentation Hoofdvergisting - + Lagering Nagisting/lagering - + Bottle Bottelen - + Kegs Fusten diff -r 9e0da3824cf9 -r 00757c056ca6 ui/EditProduct.ui --- a/ui/EditProduct.ui Sat Dec 03 16:32:24 2022 +0100 +++ b/ui/EditProduct.ui Sun Jan 08 15:53:16 2023 +0100 @@ -3684,7 +3684,7 @@ - Dry yeast claculation. + Dry yeast calculation.