src/Utils.cpp

Sat, 19 Aug 2023 16:58:03 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Sat, 19 Aug 2023 16:58:03 +0200
changeset 498
c6f957fa7442
parent 454
2dfead81c72f
permissions
-rw-r--r--

In fermentation plot draw the SG line with temperature compensation.

20
fcbbddcc22c1 Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1 /**
fcbbddcc22c1 Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2 * Utils.cpp is part of bmsapp.
fcbbddcc22c1 Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3 *
fcbbddcc22c1 Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4 * bmsapp is free software: you can redistribute it and/or modify
fcbbddcc22c1 Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
5 * it under the terms of the GNU General Public License as published by
fcbbddcc22c1 Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
6 * the Free Software Foundation, either version 3 of the License, or
fcbbddcc22c1 Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
7 * (at your option) any later version.
fcbbddcc22c1 Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
8 *
fcbbddcc22c1 Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
9 * bmsapp is distributed in the hope that it will be useful,
fcbbddcc22c1 Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
fcbbddcc22c1 Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
fcbbddcc22c1 Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
12 * GNU General Public License for more details.
fcbbddcc22c1 Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
13 *
fcbbddcc22c1 Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
14 * You should have received a copy of the GNU General Public License
fcbbddcc22c1 Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
fcbbddcc22c1 Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
16 */
fcbbddcc22c1 Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
17 #include "Utils.h"
102
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
18 #include "MainWindow.h"
131
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 125
diff changeset
19 #include "global.h"
20
fcbbddcc22c1 Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
20
42
88e827ea7172 Fixed recommend mash checkmark in fermentable editor. Added fermentables XML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
21 #include <QDebug>
20
fcbbddcc22c1 Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
22 #include <math.h>
fcbbddcc22c1 Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
23
fcbbddcc22c1 Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
24
fcbbddcc22c1 Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
25 double Utils::lintner_to_kolbach(double lintner)
fcbbddcc22c1 Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
26 {
fcbbddcc22c1 Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
27 double wk = (3.5 * lintner) - 16;
fcbbddcc22c1 Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
28 if (wk < 0)
fcbbddcc22c1 Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
29 return 0.0;
fcbbddcc22c1 Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
30 return wk;
fcbbddcc22c1 Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
31 }
fcbbddcc22c1 Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
32
fcbbddcc22c1 Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
33
fcbbddcc22c1 Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
34 double Utils::kolbach_to_lintner(double kolbach)
fcbbddcc22c1 Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
35 {
29
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents: 20
diff changeset
36 return round(((kolbach + 16) / 3.5) * 1000.0) / 1000.0;
20
fcbbddcc22c1 Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
37 }
fcbbddcc22c1 Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
38
42
88e827ea7172 Fixed recommend mash checkmark in fermentable editor. Added fermentables XML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
39
98
1425bf3e18ed Solved the segmentation fault when viewing recipes twice. Set colored display for the EBC color fields using a modified dynamic stylesheet.
Michiel Broek <mbroek@mbse.eu>
parents: 95
diff changeset
40 /**
1425bf3e18ed Solved the segmentation fault when viewing recipes twice. Set colored display for the EBC color fields using a modified dynamic stylesheet.
Michiel Broek <mbroek@mbse.eu>
parents: 95
diff changeset
41 * Often used formulas divide or multiply with 1.97 to convert between EBC and SRM.
1425bf3e18ed Solved the segmentation fault when viewing recipes twice. Set colored display for the EBC color fields using a modified dynamic stylesheet.
Michiel Broek <mbroek@mbse.eu>
parents: 95
diff changeset
42 * Almost all software in the world use this '1.97' formula.
1425bf3e18ed Solved the segmentation fault when viewing recipes twice. Set colored display for the EBC color fields using a modified dynamic stylesheet.
Michiel Broek <mbroek@mbse.eu>
parents: 95
diff changeset
43 * The only alternative I have seen is "srm = (ebc * 0.375 + 0.46)", and that has
1425bf3e18ed Solved the segmentation fault when viewing recipes twice. Set colored display for the EBC color fields using a modified dynamic stylesheet.
Michiel Broek <mbroek@mbse.eu>
parents: 95
diff changeset
44 * almost the same results as the formulas used in this program.
1425bf3e18ed Solved the segmentation fault when viewing recipes twice. Set colored display for the EBC color fields using a modified dynamic stylesheet.
Michiel Broek <mbroek@mbse.eu>
parents: 95
diff changeset
45 * These formulas come from the Dutch 'brouwhulp' program written by Adrie Otten.
163
6cccd340ea8c Version 0.1.3. Mash name can be edited manual. Added a remark about EBC calculations. Updated dustch translation. Still items in recipe tables are not shown translated, another qt mistery. Extended some number input ranges for large batches.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
46 *
6cccd340ea8c Version 0.1.3. Mash name can be edited manual. Added a remark about EBC calculations. Updated dustch translation. Still items in recipe tables are not shown translated, another qt mistery. Extended some number input ranges for large batches.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
47 * Seems that the 'brouwhulp' version use the old EBC conversion (see below) and
6cccd340ea8c Version 0.1.3. Mash name can be edited manual. Added a remark about EBC calculations. Updated dustch translation. Still items in recipe tables are not shown translated, another qt mistery. Extended some number input ranges for large batches.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
48 * not the new 1.97 formula. Make it selectable?
98
1425bf3e18ed Solved the segmentation fault when viewing recipes twice. Set colored display for the EBC color fields using a modified dynamic stylesheet.
Michiel Broek <mbroek@mbse.eu>
parents: 95
diff changeset
49 */
42
88e827ea7172 Fixed recommend mash checkmark in fermentable editor. Added fermentables XML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
50 double Utils::ebc_to_srm(double ebc)
88e827ea7172 Fixed recommend mash checkmark in fermentable editor. Added fermentables XML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
51 {
98
1425bf3e18ed Solved the segmentation fault when viewing recipes twice. Set colored display for the EBC color fields using a modified dynamic stylesheet.
Michiel Broek <mbroek@mbse.eu>
parents: 95
diff changeset
52 double srm = -0.00000000000132303 * pow(ebc, 4) - 0.00000000291515 * pow(ebc, 3) + 0.00000818515 * pow(ebc, 2) + 0.372038 * ebc + 0.596351;
42
88e827ea7172 Fixed recommend mash checkmark in fermentable editor. Added fermentables XML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
53 if (ebc < 0 || srm < 0)
281
af3dac6ff6c3 Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
54 return 0;
42
88e827ea7172 Fixed recommend mash checkmark in fermentable editor. Added fermentables XML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
55 return srm;
88e827ea7172 Fixed recommend mash checkmark in fermentable editor. Added fermentables XML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
56 }
88e827ea7172 Fixed recommend mash checkmark in fermentable editor. Added fermentables XML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
57
88e827ea7172 Fixed recommend mash checkmark in fermentable editor. Added fermentables XML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
58
88e827ea7172 Fixed recommend mash checkmark in fermentable editor. Added fermentables XML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
59 double Utils::srm_to_ebc(double srm)
88e827ea7172 Fixed recommend mash checkmark in fermentable editor. Added fermentables XML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
60 {
88e827ea7172 Fixed recommend mash checkmark in fermentable editor. Added fermentables XML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
61 double ebc = round( 0.000000000176506 * pow(srm, 4) + 0.000000154529 * pow(srm, 3) - 0.000159428 * pow(srm, 2) + 2.68837 * srm - 1.6004 );
88e827ea7172 Fixed recommend mash checkmark in fermentable editor. Added fermentables XML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
62 if ((ebc < 0) || (srm < 0))
281
af3dac6ff6c3 Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
63 return 0;
42
88e827ea7172 Fixed recommend mash checkmark in fermentable editor. Added fermentables XML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
64 return ebc;
88e827ea7172 Fixed recommend mash checkmark in fermentable editor. Added fermentables XML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
65 }
88e827ea7172 Fixed recommend mash checkmark in fermentable editor. Added fermentables XML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
66
88e827ea7172 Fixed recommend mash checkmark in fermentable editor. Added fermentables XML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
67
57
75d11cc05ce4 Added profile fermentation tables and editor.
Michiel Broek <mbroek@mbse.eu>
parents: 42
diff changeset
68 QString Utils::hours_to_string(int hours)
75d11cc05ce4 Added profile fermentation tables and editor.
Michiel Broek <mbroek@mbse.eu>
parents: 42
diff changeset
69 {
92
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents: 57
diff changeset
70 int dd, hh;
57
75d11cc05ce4 Added profile fermentation tables and editor.
Michiel Broek <mbroek@mbse.eu>
parents: 42
diff changeset
71
75d11cc05ce4 Added profile fermentation tables and editor.
Michiel Broek <mbroek@mbse.eu>
parents: 42
diff changeset
72 if (hours == 1)
75d11cc05ce4 Added profile fermentation tables and editor.
Michiel Broek <mbroek@mbse.eu>
parents: 42
diff changeset
73 return QObject::tr("1 hour");
75d11cc05ce4 Added profile fermentation tables and editor.
Michiel Broek <mbroek@mbse.eu>
parents: 42
diff changeset
74 if (hours < 24)
75d11cc05ce4 Added profile fermentation tables and editor.
Michiel Broek <mbroek@mbse.eu>
parents: 42
diff changeset
75 return QString("%1 ").arg(hours) + QString(QObject::tr("hours"));
75d11cc05ce4 Added profile fermentation tables and editor.
Michiel Broek <mbroek@mbse.eu>
parents: 42
diff changeset
76
75d11cc05ce4 Added profile fermentation tables and editor.
Michiel Broek <mbroek@mbse.eu>
parents: 42
diff changeset
77 dd = hours / 24;
75d11cc05ce4 Added profile fermentation tables and editor.
Michiel Broek <mbroek@mbse.eu>
parents: 42
diff changeset
78 hh = hours % 24;
75d11cc05ce4 Added profile fermentation tables and editor.
Michiel Broek <mbroek@mbse.eu>
parents: 42
diff changeset
79 if (dd == 1) {
75d11cc05ce4 Added profile fermentation tables and editor.
Michiel Broek <mbroek@mbse.eu>
parents: 42
diff changeset
80 if (hh == 0)
75d11cc05ce4 Added profile fermentation tables and editor.
Michiel Broek <mbroek@mbse.eu>
parents: 42
diff changeset
81 return QString(QObject::tr("1 day"));
75d11cc05ce4 Added profile fermentation tables and editor.
Michiel Broek <mbroek@mbse.eu>
parents: 42
diff changeset
82 else if (hh == 1)
75d11cc05ce4 Added profile fermentation tables and editor.
Michiel Broek <mbroek@mbse.eu>
parents: 42
diff changeset
83 return QString(QObject::tr("1 day, ")) + QString("%1 ").arg(hh) + QString(QObject::tr("hour"));
75d11cc05ce4 Added profile fermentation tables and editor.
Michiel Broek <mbroek@mbse.eu>
parents: 42
diff changeset
84 else
75d11cc05ce4 Added profile fermentation tables and editor.
Michiel Broek <mbroek@mbse.eu>
parents: 42
diff changeset
85 return QString(QObject::tr("1 day, ")) + QString("%1 ").arg(hh) + QString(QObject::tr("hours"));
75d11cc05ce4 Added profile fermentation tables and editor.
Michiel Broek <mbroek@mbse.eu>
parents: 42
diff changeset
86 } else {
75d11cc05ce4 Added profile fermentation tables and editor.
Michiel Broek <mbroek@mbse.eu>
parents: 42
diff changeset
87 if (hh == 0)
75d11cc05ce4 Added profile fermentation tables and editor.
Michiel Broek <mbroek@mbse.eu>
parents: 42
diff changeset
88 return QString("%1 ").arg(dd) + QString(QObject::tr("days"));
75d11cc05ce4 Added profile fermentation tables and editor.
Michiel Broek <mbroek@mbse.eu>
parents: 42
diff changeset
89 else if (hh == 1)
75d11cc05ce4 Added profile fermentation tables and editor.
Michiel Broek <mbroek@mbse.eu>
parents: 42
diff changeset
90 return QString("%1 ").arg(dd) + QString(QObject::tr("days, ")) + QString("%1 ").arg(hh) + QString(QObject::tr("hour"));
75d11cc05ce4 Added profile fermentation tables and editor.
Michiel Broek <mbroek@mbse.eu>
parents: 42
diff changeset
91 else
75d11cc05ce4 Added profile fermentation tables and editor.
Michiel Broek <mbroek@mbse.eu>
parents: 42
diff changeset
92 return QString("%1 ").arg(dd) + QString(QObject::tr("days, ")) + QString("%1 ").arg(hh) + QString(QObject::tr("hours"));
75d11cc05ce4 Added profile fermentation tables and editor.
Michiel Broek <mbroek@mbse.eu>
parents: 42
diff changeset
93 }
75d11cc05ce4 Added profile fermentation tables and editor.
Michiel Broek <mbroek@mbse.eu>
parents: 42
diff changeset
94 return QString("hours_to_string error");
75d11cc05ce4 Added profile fermentation tables and editor.
Michiel Broek <mbroek@mbse.eu>
parents: 42
diff changeset
95 }
75d11cc05ce4 Added profile fermentation tables and editor.
Michiel Broek <mbroek@mbse.eu>
parents: 42
diff changeset
96
75d11cc05ce4 Added profile fermentation tables and editor.
Michiel Broek <mbroek@mbse.eu>
parents: 42
diff changeset
97
95
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
98 QColor Utils::srm_to_color(int srm)
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
99 {
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
100 int i;
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
101 QColor result;
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
102
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
103 i = round(srm * 10);
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
104 if (i < 0)
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
105 i = 0;
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
106 if (i > 299)
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
107 i = 299;
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
108
98
1425bf3e18ed Solved the segmentation fault when viewing recipes twice. Set colored display for the EBC color fields using a modified dynamic stylesheet.
Michiel Broek <mbroek@mbse.eu>
parents: 95
diff changeset
109 // A well known table for SRM to RGB conversion, range 0.1 to 30 SRM.
95
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
110 const int R[] {
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
111 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, //0
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
112 250, 250, 250, 250, 250, 249, 248, 247, 246, 245, 244, 243, 242, 241, 240, 239, 238, 237, 236, 235, //2
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
113 234, 233, 232, 231, 230, 229, 228, 227, 226, 225, 224, 223, 222, 221, 220, 219, 218, 217, 216, 215, //4
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
114 214, 213, 212, 211, 210, 209, 208, 207, 206, 205, 204, 203, 202, 201, 200, 200, 199, 199, 198, 198, //6
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
115 197, 197, 196, 196, 195, 195, 194, 194, 193, 193, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, //8
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
116 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, //10
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
117 192, 192, 192, 192, 192, 192, 192, 192, 191, 190, 189, 188, 187, 186, 185, 184, 183, 182, 181, 180, //12
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
118 179, 178, 177, 175, 174, 172, 171, 169, 168, 167, 195, 164, 162, 161, 159, 158, 157, 155, 154, 152, //14
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
119 151, 149, 148, 147, 145, 144, 142, 141, 139, 138, 137, 135, 134, 132, 131, 129, 128, 127, 125, 124, //16
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
120 122, 121, 119, 118, 117, 115, 114, 112, 111, 109, 108, 107, 105, 104, 102, 101, 99, 98, 97, 95, //18
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
121 94, 92, 91, 89, 88, 87, 85, 84, 82, 81, 79, 78, 77, 75, 74, 72, 71, 69, 68, 67, //20
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
122 65, 64, 62, 61, 59, 58, 57, 55, 54, 52, 51, 49, 48, 47, 45, 44, 43, 41, 39, 38, //22
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
123 37, 37, 36, 36, 35, 35, 34, 34, 33, 33, 32, 32, 31, 31, 30, 30, 29, 29, 28, 28, //24
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
124 27, 27, 26, 26, 25, 25, 24, 24, 23, 23, 22, 22, 21, 21, 20, 20, 19, 19, 18, 18, //26
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
125 17, 17, 16, 16, 15, 15, 14, 14, 13, 13, 12, 12, 11, 11, 10, 10, 9, 9, 8, 8};
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
126
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
127 const int G[] {
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
128 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250,
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
129 250, 250, 250, 250, 250, 250, 249, 248, 247, 246, 245, 244, 242, 240, 238, 236, 234, 232, 230, 228,
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
130 226, 224, 222, 220, 218, 216, 214, 212, 210, 208, 206, 204, 202, 200, 198, 196, 194, 192, 190, 188,
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
131 186, 184, 182, 180, 178, 176, 174, 172, 170, 168, 166, 164, 162, 160, 158, 156, 154, 152, 150, 148,
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
132 146, 144, 142, 141, 140, 139, 139, 138, 137, 136, 136, 135, 134, 133, 133, 132, 131, 130, 130, 129,
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
133 128, 127, 127, 126, 125, 124, 124, 123, 122, 121, 121, 120, 119, 118, 118, 117, 116, 115, 115, 114,
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
134 113, 112, 112, 111, 110, 109, 109, 108, 107, 106, 106, 105, 104, 103, 103, 102, 101, 100, 100, 99,
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
135 98, 97, 97, 96, 95, 94, 94, 93, 92, 91, 91, 90, 89, 88, 88, 87, 86, 85, 85, 84,
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
136 83, 82, 82, 81, 80, 79, 78, 77, 76, 75, 75, 74, 73, 72, 72, 71, 70, 69, 69, 68,
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
137 67, 66, 66, 65, 64, 63, 63, 62, 61, 60, 60, 59, 58, 57, 57, 56, 55, 54, 54, 53,
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
138 52, 51, 51, 50, 49, 48, 48, 47, 46, 45, 45, 44, 43, 42, 42, 41, 40, 39, 39, 38,
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
139 37, 36, 36, 35, 34, 33, 33, 32, 31, 30, 30, 29, 28, 27, 27, 26, 25, 24, 24, 23,
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
140 22, 22, 22, 21, 21, 21, 20, 20, 20, 19, 19, 19, 18, 18, 18, 17, 17, 17, 16, 16,
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
141 16, 15, 15, 15, 14, 14, 14, 13, 13, 13, 12, 12, 12, 11, 11, 11, 10, 10, 10, 9,
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
142 9, 9, 8, 8, 8, 7, 7, 7, 6, 6, 6, 5, 5, 5, 4, 4, 4, 3, 3, 3};
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
143
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
144 const int B[] {
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
145 210, 204, 199, 193, 188, 182, 177, 171, 166, 160, 155, 149, 144, 138, 133, 127, 122, 116, 111, 105,
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
146 100, 94, 89, 83, 78, 72, 67, 61, 56, 50, 45, 45, 45, 46, 46, 46, 46, 47, 47, 47,
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
147 47, 48, 48, 48, 48, 49, 49, 49, 49, 50, 50, 50, 50, 51, 51, 51, 51, 52, 52, 52,
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
148 52, 53, 53, 53, 53, 54, 54, 54, 54, 55, 55, 55, 55, 56, 56, 56, 56, 56, 56, 56,
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
149 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
150 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
151 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
152 56, 56, 56, 55, 55, 55, 55, 54, 54, 54, 54, 53, 53, 53, 53, 52, 52, 52, 52, 51,
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
153 51, 51, 51, 50, 50, 50, 50, 49, 49, 48, 47, 47, 46, 45, 45, 44, 43, 43, 42, 41,
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
154 41, 40, 39, 39, 38, 37, 37, 36, 35, 34, 33, 32, 31, 29, 28, 27, 26, 25, 24, 23,
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
155 21, 20, 19, 18, 17, 16, 15, 13, 12, 11, 10, 9, 8, 9, 9, 10, 10, 11, 11, 12,
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
156 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22,
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
157 21, 21, 21, 20, 20, 20, 19, 19, 19, 18, 18, 18, 17, 17, 17, 17, 16, 16, 15, 15,
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
158 15, 14, 14, 14, 13, 13, 13, 12, 12, 12, 11, 11, 11, 10, 10, 10, 9, 9, 9, 8,
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
159 8, 8, 7, 7, 7, 6, 6, 6, 5, 5, 5, 4, 4, 4, 3, 3, 3, 2, 2, 2};
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
160
98
1425bf3e18ed Solved the segmentation fault when viewing recipes twice. Set colored display for the EBC color fields using a modified dynamic stylesheet.
Michiel Broek <mbroek@mbse.eu>
parents: 95
diff changeset
161 result = QColor::fromRgb(R[i], G[i], B[i]);
1425bf3e18ed Solved the segmentation fault when viewing recipes twice. Set colored display for the EBC color fields using a modified dynamic stylesheet.
Michiel Broek <mbroek@mbse.eu>
parents: 95
diff changeset
162 return result;
95
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
163 }
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
164
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
165
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
166 QColor Utils::ebc_to_color(int ebc)
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
167 {
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
168 return srm_to_color(ebc_to_srm(ebc));
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
169 }
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
170
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
171
98
1425bf3e18ed Solved the segmentation fault when viewing recipes twice. Set colored display for the EBC color fields using a modified dynamic stylesheet.
Michiel Broek <mbroek@mbse.eu>
parents: 95
diff changeset
172 QString Utils::srm_to_style(int srm)
1425bf3e18ed Solved the segmentation fault when viewing recipes twice. Set colored display for the EBC color fields using a modified dynamic stylesheet.
Michiel Broek <mbroek@mbse.eu>
parents: 95
diff changeset
173 {
1425bf3e18ed Solved the segmentation fault when viewing recipes twice. Set colored display for the EBC color fields using a modified dynamic stylesheet.
Michiel Broek <mbroek@mbse.eu>
parents: 95
diff changeset
174 QColor color = srm_to_color(srm);
1425bf3e18ed Solved the segmentation fault when viewing recipes twice. Set colored display for the EBC color fields using a modified dynamic stylesheet.
Michiel Broek <mbroek@mbse.eu>
parents: 95
diff changeset
175 return QString("background-color: %1; color: %2;").arg(color.name()).arg((srm > 15) ? "#E0E1E3" : "#19232D");
1425bf3e18ed Solved the segmentation fault when viewing recipes twice. Set colored display for the EBC color fields using a modified dynamic stylesheet.
Michiel Broek <mbroek@mbse.eu>
parents: 95
diff changeset
176 }
1425bf3e18ed Solved the segmentation fault when viewing recipes twice. Set colored display for the EBC color fields using a modified dynamic stylesheet.
Michiel Broek <mbroek@mbse.eu>
parents: 95
diff changeset
177
1425bf3e18ed Solved the segmentation fault when viewing recipes twice. Set colored display for the EBC color fields using a modified dynamic stylesheet.
Michiel Broek <mbroek@mbse.eu>
parents: 95
diff changeset
178
1425bf3e18ed Solved the segmentation fault when viewing recipes twice. Set colored display for the EBC color fields using a modified dynamic stylesheet.
Michiel Broek <mbroek@mbse.eu>
parents: 95
diff changeset
179 QString Utils::ebc_to_style(int ebc)
1425bf3e18ed Solved the segmentation fault when viewing recipes twice. Set colored display for the EBC color fields using a modified dynamic stylesheet.
Michiel Broek <mbroek@mbse.eu>
parents: 95
diff changeset
180 {
1425bf3e18ed Solved the segmentation fault when viewing recipes twice. Set colored display for the EBC color fields using a modified dynamic stylesheet.
Michiel Broek <mbroek@mbse.eu>
parents: 95
diff changeset
181 return srm_to_style(ebc_to_srm(ebc));
1425bf3e18ed Solved the segmentation fault when viewing recipes twice. Set colored display for the EBC color fields using a modified dynamic stylesheet.
Michiel Broek <mbroek@mbse.eu>
parents: 95
diff changeset
182 }
1425bf3e18ed Solved the segmentation fault when viewing recipes twice. Set colored display for the EBC color fields using a modified dynamic stylesheet.
Michiel Broek <mbroek@mbse.eu>
parents: 95
diff changeset
183
102
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
184
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
185 /*
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
186 * Return incremented color by the boil and yeast.
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
187 * https://www.hobbybrouwen.nl/forum/index.php/topic,19020.msg281132.html#msg281132
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
188 */
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
189 double Utils::get_kt(int ebc)
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
190 {
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
191 double kt = 1;
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
192
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
193 if (ebc < 3)
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
194 kt = 3.5;
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
195 else if (ebc < 6)
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
196 kt = 3;
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
197 else if (ebc < 8)
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
198 kt = 2.75;
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
199 else if (ebc < 10)
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
200 kt = 2.5;
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
201 else if (ebc < 20)
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
202 kt = 1.8;
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
203 else if (ebc < 30)
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
204 kt = 1.6;
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
205 else if (ebc < 60)
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
206 kt = 1.3;
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
207 else if (ebc < 100)
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
208 kt = 1.2;
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
209 else if (ebc < 300)
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
210 kt = 1.1;
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
211 return kt;
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
212 }
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
213
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
214
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
215 double Utils::sg_to_plato(double sg)
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
216 {
195
9887278c4fbe The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents: 168
diff changeset
217 // On stChiellus: return ((135.997 * sg - 630.272) * sg + 1111.14) * sg - 616.868;
102
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
218 return -668.962 + (1262.45 * sg) - (776.43 * sg * sg) + (182.94 * sg * sg * sg);
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
219 }
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
220
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
221
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
222 double Utils::plato_to_sg(double plato)
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
223 {
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
224 return 1.00001 + (0.0038661 * plato) + (1.3488e-5 * plato * plato) + (4.3074e-8 * plato * plato * plato);
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
225 }
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
226
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
227
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
228 double Utils::sg_to_brix(double sg)
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
229 {
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
230 return sg_to_plato(sg) * my_brix_correction;
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
231 }
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
232
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
233
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
234 double Utils::brix_to_sg(double brix)
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
235 {
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
236 if (my_brix_correction > 0)
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
237 return plato_to_sg(brix / my_brix_correction);
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
238 return plato_to_sg(brix);
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
239 }
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
240
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
241
219
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 218
diff changeset
242 /*
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 218
diff changeset
243 * @brief Calculate Final Gravity.
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 218
diff changeset
244 * Formula by Petr Novotny, Zymurgy July/August 2017.
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 218
diff changeset
245 * @param o_plato Original Plato.
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 218
diff changeset
246 * @param refracto the refractometer reading.
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 218
diff changeset
247 * @return Final gravity.
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 218
diff changeset
248 */
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 218
diff changeset
249 double Utils::brix_to_fg(double o_plato, double refracto)
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 218
diff changeset
250 {
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 218
diff changeset
251 double FBc = refracto / my_brix_correction;
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 218
diff changeset
252
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 218
diff changeset
253 double rc = round((1 + (0.006276 * FBc) - (0.002349 * o_plato)) * 10000.0) / 10000.0;
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 218
diff changeset
254 // qDebug() << "brix_to_plato" << o_plato << refracto << FBc << "rc" << rc;
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 218
diff changeset
255 return rc;
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 218
diff changeset
256 }
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 218
diff changeset
257
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 218
diff changeset
258
102
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
259 double Utils::calc_svg(double og, double fg)
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
260 {
218
725da10db56c Fixed wrong colors of the bars on the fermentation tab. Don't show 100% SVG if OG or FG data is missing. Changed prompts om the fermentation tab.
Michiel Broek <mbroek@mbse.eu>
parents: 215
diff changeset
261 if (og == 0.0 || fg == 0.0)
725da10db56c Fixed wrong colors of the bars on the fermentation tab. Don't show 100% SVG if OG or FG data is missing. Changed prompts om the fermentation tab.
Michiel Broek <mbroek@mbse.eu>
parents: 215
diff changeset
262 return 0;
725da10db56c Fixed wrong colors of the bars on the fermentation tab. Don't show 100% SVG if OG or FG data is missing. Changed prompts om the fermentation tab.
Michiel Broek <mbroek@mbse.eu>
parents: 215
diff changeset
263
102
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
264 double oe = sg_to_plato(og);
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
265 double ae = sg_to_plato(fg);
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
266
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
267 return (oe - ae) / oe * 100;
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
268 }
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
269
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
270
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
271 double Utils::estimate_sg(double sugars, double batch_size)
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
272 {
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
273 double plato = 100 * sugars / batch_size;
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
274 double sg = plato_to_sg(plato);
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
275 for (int i = 0; i < 20; i++) {
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
276 if (sg > 0)
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
277 plato = 100 * sugars / (batch_size * sg);
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
278 sg = plato_to_sg(plato);
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
279 }
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
280
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
281 return round(sg * 10000) / 10000;
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
282 }
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
283
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
284
453
fc0c10d79539 Calculate mash attenuation time using log base 5 instead of a linear function.
Michiel Broek <mbroek@mbse.eu>
parents: 452
diff changeset
285 /*
fc0c10d79539 Calculate mash attenuation time using log base 5 instead of a linear function.
Michiel Broek <mbroek@mbse.eu>
parents: 452
diff changeset
286 * Returns the log base b of y.
fc0c10d79539 Calculate mash attenuation time using log base 5 instead of a linear function.
Michiel Broek <mbroek@mbse.eu>
parents: 452
diff changeset
287 */
fc0c10d79539 Calculate mash attenuation time using log base 5 instead of a linear function.
Michiel Broek <mbroek@mbse.eu>
parents: 452
diff changeset
288 double Utils::logbase(double y, int b)
fc0c10d79539 Calculate mash attenuation time using log base 5 instead of a linear function.
Michiel Broek <mbroek@mbse.eu>
parents: 452
diff changeset
289 {
fc0c10d79539 Calculate mash attenuation time using log base 5 instead of a linear function.
Michiel Broek <mbroek@mbse.eu>
parents: 452
diff changeset
290 double lg;
fc0c10d79539 Calculate mash attenuation time using log base 5 instead of a linear function.
Michiel Broek <mbroek@mbse.eu>
parents: 452
diff changeset
291
fc0c10d79539 Calculate mash attenuation time using log base 5 instead of a linear function.
Michiel Broek <mbroek@mbse.eu>
parents: 452
diff changeset
292 lg = log10(y) / log10(b);
fc0c10d79539 Calculate mash attenuation time using log base 5 instead of a linear function.
Michiel Broek <mbroek@mbse.eu>
parents: 452
diff changeset
293 return lg;
fc0c10d79539 Calculate mash attenuation time using log base 5 instead of a linear function.
Michiel Broek <mbroek@mbse.eu>
parents: 452
diff changeset
294 }
fc0c10d79539 Calculate mash attenuation time using log base 5 instead of a linear function.
Michiel Broek <mbroek@mbse.eu>
parents: 452
diff changeset
295
fc0c10d79539 Calculate mash attenuation time using log base 5 instead of a linear function.
Michiel Broek <mbroek@mbse.eu>
parents: 452
diff changeset
296
449
00757c056ca6 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.
Michiel Broek <mbroek@mbse.eu>
parents: 444
diff changeset
297 double Utils::estimate_fg(double psugar, double pcara, double wgratio, double mashtime, double mashtemp, double svg, double og, bool sta1)
102
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
298 {
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
299 double BD;
453
fc0c10d79539 Calculate mash attenuation time using log base 5 instead of a linear function.
Michiel Broek <mbroek@mbse.eu>
parents: 452
diff changeset
300 double att_mashtime;
450
d4cff87ea156 In estimate_fg decrease attenuation for mash temperatures below 66.11 degrees.
Michiel Broek <mbroek@mbse.eu>
parents: 449
diff changeset
301 double att_mashtemp;
102
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
302
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
303 if (psugar > 40)
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
304 psugar = 0;
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
305 if (pcara > 50)
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
306 pcara = 0;
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
307
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
308 if (wgratio > 0 && mashtime > 0) {
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
309 BD = wgratio;
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
310 if (BD < 2)
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
311 BD = 2;
452
c4c5d02131be Limit mash steptime to 240 minutes. Limit mash steps to 82 degrees celsius. In estimate_fg limit total mash time to 240 minutes and increased the water/grain ration from 5.5 to 6 l/kg.
Michiel Broek <mbroek@mbse.eu>
parents: 450
diff changeset
312 if (BD > 6)
c4c5d02131be Limit mash steptime to 240 minutes. Limit mash steps to 82 degrees celsius. In estimate_fg limit total mash time to 240 minutes and increased the water/grain ration from 5.5 to 6 l/kg.
Michiel Broek <mbroek@mbse.eu>
parents: 450
diff changeset
313 BD = 6;
102
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
314 } else {
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
315 BD = 3.5;
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
316 mashtemp = 67;
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
317 mashtime = 75;
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
318 }
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
319 if (svg < 30)
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
320 svg = 77;
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
321
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
322 /*
449
00757c056ca6 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.
Michiel Broek <mbroek@mbse.eu>
parents: 444
diff changeset
323 * Original from brouwhulp:
452
c4c5d02131be Limit mash steptime to 240 minutes. Limit mash steps to 82 degrees celsius. In estimate_fg limit total mash time to 240 minutes and increased the water/grain ration from 5.5 to 6 l/kg.
Michiel Broek <mbroek@mbse.eu>
parents: 450
diff changeset
324 * 0.00825 Attenuation factor yeast (Real to apparant ??)
c4c5d02131be Limit mash steptime to 240 minutes. Limit mash steps to 82 degrees celsius. In estimate_fg limit total mash time to 240 minutes and increased the water/grain ration from 5.5 to 6 l/kg.
Michiel Broek <mbroek@mbse.eu>
parents: 450
diff changeset
325 * 0.00817 Attenuation factor water/grain ratio
102
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
326 * -0.00684 Attenuation factor mash temperature
452
c4c5d02131be Limit mash steptime to 240 minutes. Limit mash steps to 82 degrees celsius. In estimate_fg limit total mash time to 240 minutes and increased the water/grain ration from 5.5 to 6 l/kg.
Michiel Broek <mbroek@mbse.eu>
parents: 450
diff changeset
327 * 0.00026 Attenuation factor total mash time
102
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
328 * -0.00356 Attenuation factor percentage crystal malt
452
c4c5d02131be Limit mash steptime to 240 minutes. Limit mash steps to 82 degrees celsius. In estimate_fg limit total mash time to 240 minutes and increased the water/grain ration from 5.5 to 6 l/kg.
Michiel Broek <mbroek@mbse.eu>
parents: 450
diff changeset
329 * 0.00553 Attenuation factor percentage simple sugars
c4c5d02131be Limit mash steptime to 240 minutes. Limit mash steps to 82 degrees celsius. In estimate_fg limit total mash time to 240 minutes and increased the water/grain ration from 5.5 to 6 l/kg.
Michiel Broek <mbroek@mbse.eu>
parents: 450
diff changeset
330 * 0.547 Attenuation factor constant
c4c5d02131be Limit mash steptime to 240 minutes. Limit mash steps to 82 degrees celsius. In estimate_fg limit total mash time to 240 minutes and increased the water/grain ration from 5.5 to 6 l/kg.
Michiel Broek <mbroek@mbse.eu>
parents: 450
diff changeset
331 * 0.597 Attenuation factor constant when STA1 gen is true.
102
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
332 */
450
d4cff87ea156 In estimate_fg decrease attenuation for mash temperatures below 66.11 degrees.
Michiel Broek <mbroek@mbse.eu>
parents: 449
diff changeset
333 double top_mashtemp = 66.11; /* Highest fermentable at 151 degrees fahrenheit */
d4cff87ea156 In estimate_fg decrease attenuation for mash temperatures below 66.11 degrees.
Michiel Broek <mbroek@mbse.eu>
parents: 449
diff changeset
334 /*
d4cff87ea156 In estimate_fg decrease attenuation for mash temperatures below 66.11 degrees.
Michiel Broek <mbroek@mbse.eu>
parents: 449
diff changeset
335 * Derived from Karl Troester's data and Matt Kahn.
453
fc0c10d79539 Calculate mash attenuation time using log base 5 instead of a linear function.
Michiel Broek <mbroek@mbse.eu>
parents: 452
diff changeset
336 * Original was just: -0.00684 * mashtemp
450
d4cff87ea156 In estimate_fg decrease attenuation for mash temperatures below 66.11 degrees.
Michiel Broek <mbroek@mbse.eu>
parents: 449
diff changeset
337 */
d4cff87ea156 In estimate_fg decrease attenuation for mash temperatures below 66.11 degrees.
Michiel Broek <mbroek@mbse.eu>
parents: 449
diff changeset
338 if (mashtemp > top_mashtemp) {
d4cff87ea156 In estimate_fg decrease attenuation for mash temperatures below 66.11 degrees.
Michiel Broek <mbroek@mbse.eu>
parents: 449
diff changeset
339 /* Above optimum mash temperature decrease attenuation */
452
c4c5d02131be Limit mash steptime to 240 minutes. Limit mash steps to 82 degrees celsius. In estimate_fg limit total mash time to 240 minutes and increased the water/grain ration from 5.5 to 6 l/kg.
Michiel Broek <mbroek@mbse.eu>
parents: 450
diff changeset
340 att_mashtemp = -0.00684 * mashtemp;
450
d4cff87ea156 In estimate_fg decrease attenuation for mash temperatures below 66.11 degrees.
Michiel Broek <mbroek@mbse.eu>
parents: 449
diff changeset
341 } else {
d4cff87ea156 In estimate_fg decrease attenuation for mash temperatures below 66.11 degrees.
Michiel Broek <mbroek@mbse.eu>
parents: 449
diff changeset
342 /* Below optimum mash temperature decrease slowly attenuation */
452
c4c5d02131be Limit mash steptime to 240 minutes. Limit mash steps to 82 degrees celsius. In estimate_fg limit total mash time to 240 minutes and increased the water/grain ration from 5.5 to 6 l/kg.
Michiel Broek <mbroek@mbse.eu>
parents: 450
diff changeset
343 att_mashtemp = -0.00684 * (top_mashtemp + (top_mashtemp - mashtemp) / 4);
450
d4cff87ea156 In estimate_fg decrease attenuation for mash temperatures below 66.11 degrees.
Michiel Broek <mbroek@mbse.eu>
parents: 449
diff changeset
344 }
d4cff87ea156 In estimate_fg decrease attenuation for mash temperatures below 66.11 degrees.
Michiel Broek <mbroek@mbse.eu>
parents: 449
diff changeset
345
453
fc0c10d79539 Calculate mash attenuation time using log base 5 instead of a linear function.
Michiel Broek <mbroek@mbse.eu>
parents: 452
diff changeset
346 /*
fc0c10d79539 Calculate mash attenuation time using log base 5 instead of a linear function.
Michiel Broek <mbroek@mbse.eu>
parents: 452
diff changeset
347 * Reference is set at 60 minutes equals old formula
fc0c10d79539 Calculate mash attenuation time using log base 5 instead of a linear function.
Michiel Broek <mbroek@mbse.eu>
parents: 452
diff changeset
348 * Use log base 5 to create a good realistic response.
fc0c10d79539 Calculate mash attenuation time using log base 5 instead of a linear function.
Michiel Broek <mbroek@mbse.eu>
parents: 452
diff changeset
349 * With mashtime < 12 minutes, the result will be negative, good.
fc0c10d79539 Calculate mash attenuation time using log base 5 instead of a linear function.
Michiel Broek <mbroek@mbse.eu>
parents: 452
diff changeset
350 */
fc0c10d79539 Calculate mash attenuation time using log base 5 instead of a linear function.
Michiel Broek <mbroek@mbse.eu>
parents: 452
diff changeset
351 att_mashtime = logbase(mashtime / 12, 5) * 0.0156;
fc0c10d79539 Calculate mash attenuation time using log base 5 instead of a linear function.
Michiel Broek <mbroek@mbse.eu>
parents: 452
diff changeset
352 //qDebug() << "estimate_fg temp" << att_mashtemp << "time" << att_mashtime;
fc0c10d79539 Calculate mash attenuation time using log base 5 instead of a linear function.
Michiel Broek <mbroek@mbse.eu>
parents: 452
diff changeset
353
fc0c10d79539 Calculate mash attenuation time using log base 5 instead of a linear function.
Michiel Broek <mbroek@mbse.eu>
parents: 452
diff changeset
354 double AttBeer = 0.00825 * svg + 0.00817 * BD + att_mashtemp + att_mashtime - 0.00356 * pcara + 0.00553 * psugar;
449
00757c056ca6 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.
Michiel Broek <mbroek@mbse.eu>
parents: 444
diff changeset
355 AttBeer += (sta1) ? 0.597:0.547;
452
c4c5d02131be Limit mash steptime to 240 minutes. Limit mash steps to 82 degrees celsius. In estimate_fg limit total mash time to 240 minutes and increased the water/grain ration from 5.5 to 6 l/kg.
Michiel Broek <mbroek@mbse.eu>
parents: 450
diff changeset
356 qDebug() << "estimate_fg(" << psugar << pcara << BD << mashtime << mashtemp << svg << og << sta1 << ") AttBeer:" << AttBeer;
102
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
357 return round((1 + (1 - AttBeer) * (og -1)) * 10000) / 10000;
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
358 }
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
359
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
360
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
361 /*
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
362 * Kleurwerking to SRM. Not for Halberstadt, Naudts.
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
363 */
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
364 double Utils::kw_to_srm(int colormethod, double c)
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
365 {
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
366 if (colormethod == 0)
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
367 return 1.4922 * pow(c, 0.6859); //Morey
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
368 if (colormethod == 1)
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
369 return 0.3 * c + 4.7; //Mosher
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
370 if (colormethod == 2)
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
371 return 0.2 * c + 8.4; //Daniels
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
372 return 0; //Halberstadt,Naudts
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
373 }
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
374
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
375
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
376 double Utils::kw_to_ebc(int colormethod, double c)
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
377 {
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
378 return srm_to_ebc(kw_to_srm(colormethod, c));
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
379 }
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
380
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
381
168
4bc92122d001 Added kw_to_newebc function to debug EBC differences.
Michiel Broek <mbroek@mbse.eu>
parents: 163
diff changeset
382 double Utils::kw_to_newebc(int colormethod, double c)
4bc92122d001 Added kw_to_newebc function to debug EBC differences.
Michiel Broek <mbroek@mbse.eu>
parents: 163
diff changeset
383 {
4bc92122d001 Added kw_to_newebc function to debug EBC differences.
Michiel Broek <mbroek@mbse.eu>
parents: 163
diff changeset
384 return 1.97 * kw_to_srm(colormethod, c);
4bc92122d001 Added kw_to_newebc function to debug EBC differences.
Michiel Broek <mbroek@mbse.eu>
parents: 163
diff changeset
385 }
4bc92122d001 Added kw_to_newebc function to debug EBC differences.
Michiel Broek <mbroek@mbse.eu>
parents: 163
diff changeset
386
4bc92122d001 Added kw_to_newebc function to debug EBC differences.
Michiel Broek <mbroek@mbse.eu>
parents: 163
diff changeset
387
102
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
388 double Utils::abvol(double og, double fg)
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
389 {
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
390 if (((og - fg) < 0) || (fg < 0.9))
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
391 return 0;
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
392
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
393 double factor = og * 3157 * pow(10, -5) + 9.716 * pow(10, -2);
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
394 return round((og * 1000 - fg * 1000) * factor * 100) / 100;
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
395 }
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
396
337
8133cdb19aa1 Added my_height global variable and edit in profile setup. This sets the height of the brewery above or below sealevel. Added calculations for the air pressure, boilpoint and IBU_reduction that all depend on the height. Currently not yet in use. Split out the real IBU calculation from the generic toIBU function. This has no effect on the results.
Michiel Broek <mbroek@mbse.eu>
parents: 336
diff changeset
397
8133cdb19aa1 Added my_height global variable and edit in profile setup. This sets the height of the brewery above or below sealevel. Added calculations for the air pressure, boilpoint and IBU_reduction that all depend on the height. Currently not yet in use. Split out the real IBU calculation from the generic toIBU function. This has no effect on the results.
Michiel Broek <mbroek@mbse.eu>
parents: 336
diff changeset
398 double Utils::brewery_hPa()
8133cdb19aa1 Added my_height global variable and edit in profile setup. This sets the height of the brewery above or below sealevel. Added calculations for the air pressure, boilpoint and IBU_reduction that all depend on the height. Currently not yet in use. Split out the real IBU calculation from the generic toIBU function. This has no effect on the results.
Michiel Broek <mbroek@mbse.eu>
parents: 336
diff changeset
399 {
8133cdb19aa1 Added my_height global variable and edit in profile setup. This sets the height of the brewery above or below sealevel. Added calculations for the air pressure, boilpoint and IBU_reduction that all depend on the height. Currently not yet in use. Split out the real IBU calculation from the generic toIBU function. This has no effect on the results.
Michiel Broek <mbroek@mbse.eu>
parents: 336
diff changeset
400 return Seapressure * exp( - MolMassAir * Gravacc * my_height / (Gasconst * (20 + Kelvin)));
8133cdb19aa1 Added my_height global variable and edit in profile setup. This sets the height of the brewery above or below sealevel. Added calculations for the air pressure, boilpoint and IBU_reduction that all depend on the height. Currently not yet in use. Split out the real IBU calculation from the generic toIBU function. This has no effect on the results.
Michiel Broek <mbroek@mbse.eu>
parents: 336
diff changeset
401 }
8133cdb19aa1 Added my_height global variable and edit in profile setup. This sets the height of the brewery above or below sealevel. Added calculations for the air pressure, boilpoint and IBU_reduction that all depend on the height. Currently not yet in use. Split out the real IBU calculation from the generic toIBU function. This has no effect on the results.
Michiel Broek <mbroek@mbse.eu>
parents: 336
diff changeset
402
8133cdb19aa1 Added my_height global variable and edit in profile setup. This sets the height of the brewery above or below sealevel. Added calculations for the air pressure, boilpoint and IBU_reduction that all depend on the height. Currently not yet in use. Split out the real IBU calculation from the generic toIBU function. This has no effect on the results.
Michiel Broek <mbroek@mbse.eu>
parents: 336
diff changeset
403
8133cdb19aa1 Added my_height global variable and edit in profile setup. This sets the height of the brewery above or below sealevel. Added calculations for the air pressure, boilpoint and IBU_reduction that all depend on the height. Currently not yet in use. Split out the real IBU calculation from the generic toIBU function. This has no effect on the results.
Michiel Broek <mbroek@mbse.eu>
parents: 336
diff changeset
404 double Utils::boilPoint()
8133cdb19aa1 Added my_height global variable and edit in profile setup. This sets the height of the brewery above or below sealevel. Added calculations for the air pressure, boilpoint and IBU_reduction that all depend on the height. Currently not yet in use. Split out the real IBU calculation from the generic toIBU function. This has no effect on the results.
Michiel Broek <mbroek@mbse.eu>
parents: 336
diff changeset
405 {
8133cdb19aa1 Added my_height global variable and edit in profile setup. This sets the height of the brewery above or below sealevel. Added calculations for the air pressure, boilpoint and IBU_reduction that all depend on the height. Currently not yet in use. Split out the real IBU calculation from the generic toIBU function. This has no effect on the results.
Michiel Broek <mbroek@mbse.eu>
parents: 336
diff changeset
406 double P2 = brewery_hPa();
8133cdb19aa1 Added my_height global variable and edit in profile setup. This sets the height of the brewery above or below sealevel. Added calculations for the air pressure, boilpoint and IBU_reduction that all depend on the height. Currently not yet in use. Split out the real IBU calculation from the generic toIBU function. This has no effect on the results.
Michiel Broek <mbroek@mbse.eu>
parents: 336
diff changeset
407
8133cdb19aa1 Added my_height global variable and edit in profile setup. This sets the height of the brewery above or below sealevel. Added calculations for the air pressure, boilpoint and IBU_reduction that all depend on the height. Currently not yet in use. Split out the real IBU calculation from the generic toIBU function. This has no effect on the results.
Michiel Broek <mbroek@mbse.eu>
parents: 336
diff changeset
408 return (1 / (1/(100 + Kelvin) - Gasconst * log(P2 / Seapressure) / EoVwater)) - Kelvin;
8133cdb19aa1 Added my_height global variable and edit in profile setup. This sets the height of the brewery above or below sealevel. Added calculations for the air pressure, boilpoint and IBU_reduction that all depend on the height. Currently not yet in use. Split out the real IBU calculation from the generic toIBU function. This has no effect on the results.
Michiel Broek <mbroek@mbse.eu>
parents: 336
diff changeset
409 }
8133cdb19aa1 Added my_height global variable and edit in profile setup. This sets the height of the brewery above or below sealevel. Added calculations for the air pressure, boilpoint and IBU_reduction that all depend on the height. Currently not yet in use. Split out the real IBU calculation from the generic toIBU function. This has no effect on the results.
Michiel Broek <mbroek@mbse.eu>
parents: 336
diff changeset
410
8133cdb19aa1 Added my_height global variable and edit in profile setup. This sets the height of the brewery above or below sealevel. Added calculations for the air pressure, boilpoint and IBU_reduction that all depend on the height. Currently not yet in use. Split out the real IBU calculation from the generic toIBU function. This has no effect on the results.
Michiel Broek <mbroek@mbse.eu>
parents: 336
diff changeset
411
336
e97f9e87d94b IBU method names are now global.
Michiel Broek <mbroek@mbse.eu>
parents: 300
diff changeset
412 /*
337
8133cdb19aa1 Added my_height global variable and edit in profile setup. This sets the height of the brewery above or below sealevel. Added calculations for the air pressure, boilpoint and IBU_reduction that all depend on the height. Currently not yet in use. Split out the real IBU calculation from the generic toIBU function. This has no effect on the results.
Michiel Broek <mbroek@mbse.eu>
parents: 336
diff changeset
413 * Formula is from the 'Mash Made Easy' spreadsheet.
8133cdb19aa1 Added my_height global variable and edit in profile setup. This sets the height of the brewery above or below sealevel. Added calculations for the air pressure, boilpoint and IBU_reduction that all depend on the height. Currently not yet in use. Split out the real IBU calculation from the generic toIBU function. This has no effect on the results.
Michiel Broek <mbroek@mbse.eu>
parents: 336
diff changeset
414 * https://mashmadeeasy.yolasite.com/
8133cdb19aa1 Added my_height global variable and edit in profile setup. This sets the height of the brewery above or below sealevel. Added calculations for the air pressure, boilpoint and IBU_reduction that all depend on the height. Currently not yet in use. Split out the real IBU calculation from the generic toIBU function. This has no effect on the results.
Michiel Broek <mbroek@mbse.eu>
parents: 336
diff changeset
415 * https://www.homebrewtalk.com/threads/a-rather-simplified-whirlpool-hop-ibu-computation-method.701093/
339
2f3cfb983fcc Removed Garetz and Rager IBU calculations, we will only use Tinseth
Michiel Broek <mbroek@mbse.eu>
parents: 337
diff changeset
416 *
2f3cfb983fcc Removed Garetz and Rager IBU calculations, we will only use Tinseth
Michiel Broek <mbroek@mbse.eu>
parents: 337
diff changeset
417 * Source of the formula Mark G. Malowicki.
337
8133cdb19aa1 Added my_height global variable and edit in profile setup. This sets the height of the brewery above or below sealevel. Added calculations for the air pressure, boilpoint and IBU_reduction that all depend on the height. Currently not yet in use. Split out the real IBU calculation from the generic toIBU function. This has no effect on the results.
Michiel Broek <mbroek@mbse.eu>
parents: 336
diff changeset
418 */
8133cdb19aa1 Added my_height global variable and edit in profile setup. This sets the height of the brewery above or below sealevel. Added calculations for the air pressure, boilpoint and IBU_reduction that all depend on the height. Currently not yet in use. Split out the real IBU calculation from the generic toIBU function. This has no effect on the results.
Michiel Broek <mbroek@mbse.eu>
parents: 336
diff changeset
419 double Utils::IBU_reduction(double Tc)
8133cdb19aa1 Added my_height global variable and edit in profile setup. This sets the height of the brewery above or below sealevel. Added calculations for the air pressure, boilpoint and IBU_reduction that all depend on the height. Currently not yet in use. Split out the real IBU calculation from the generic toIBU function. This has no effect on the results.
Michiel Broek <mbroek@mbse.eu>
parents: 336
diff changeset
420 {
339
2f3cfb983fcc Removed Garetz and Rager IBU calculations, we will only use Tinseth
Michiel Broek <mbroek@mbse.eu>
parents: 337
diff changeset
421 /*
2f3cfb983fcc Removed Garetz and Rager IBU calculations, we will only use Tinseth
Michiel Broek <mbroek@mbse.eu>
parents: 337
diff changeset
422 * Original formula plus a small correction factor.
2f3cfb983fcc Removed Garetz and Rager IBU calculations, we will only use Tinseth
Michiel Broek <mbroek@mbse.eu>
parents: 337
diff changeset
423 */
342
0d14f1f565c4 Code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 340
diff changeset
424 return 2.39 * pow(10, 11) * exp(-(9773 / (Tc + Kelvin))) * 1 / 1.009231743647;
337
8133cdb19aa1 Added my_height global variable and edit in profile setup. This sets the height of the brewery above or below sealevel. Added calculations for the air pressure, boilpoint and IBU_reduction that all depend on the height. Currently not yet in use. Split out the real IBU calculation from the generic toIBU function. This has no effect on the results.
Michiel Broek <mbroek@mbse.eu>
parents: 336
diff changeset
425 }
8133cdb19aa1 Added my_height global variable and edit in profile setup. This sets the height of the brewery above or below sealevel. Added calculations for the air pressure, boilpoint and IBU_reduction that all depend on the height. Currently not yet in use. Split out the real IBU calculation from the generic toIBU function. This has no effect on the results.
Michiel Broek <mbroek@mbse.eu>
parents: 336
diff changeset
426
8133cdb19aa1 Added my_height global variable and edit in profile setup. This sets the height of the brewery above or below sealevel. Added calculations for the air pressure, boilpoint and IBU_reduction that all depend on the height. Currently not yet in use. Split out the real IBU calculation from the generic toIBU function. This has no effect on the results.
Michiel Broek <mbroek@mbse.eu>
parents: 336
diff changeset
427
373
b02aca4e926c First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents: 356
diff changeset
428 double Utils::TinsethIBU(int Form, double SG, double Volume, double Amount, double T1, double T2, double Alpha, double Utilisation, double BU_factor)
336
e97f9e87d94b IBU method names are now global.
Michiel Broek <mbroek@mbse.eu>
parents: 300
diff changeset
429 {
337
8133cdb19aa1 Added my_height global variable and edit in profile setup. This sets the height of the brewery above or below sealevel. Added calculations for the air pressure, boilpoint and IBU_reduction that all depend on the height. Currently not yet in use. Split out the real IBU calculation from the generic toIBU function. This has no effect on the results.
Michiel Broek <mbroek@mbse.eu>
parents: 336
diff changeset
430 double alpha = Alpha / 100.0;
8133cdb19aa1 Added my_height global variable and edit in profile setup. This sets the height of the brewery above or below sealevel. Added calculations for the air pressure, boilpoint and IBU_reduction that all depend on the height. Currently not yet in use. Split out the real IBU calculation from the generic toIBU function. This has no effect on the results.
Michiel Broek <mbroek@mbse.eu>
parents: 336
diff changeset
431 double mass = Amount * 1000.0;
373
b02aca4e926c First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents: 356
diff changeset
432
b02aca4e926c First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents: 356
diff changeset
433 /*
375
c21567bfd703 Final set the default utilisation to 20. Selecting another hop in a product now sets the new utilisation and bu_factor too. Removed experimental CO2 extract calculation and let it handle by the Tinseth formula. The Tinseth formula uses the Utilisation value in the final calculation. Moved the ISO extract formula for extract at bottling to the main toIBU function.
Michiel Broek <mbroek@mbse.eu>
parents: 373
diff changeset
434 * Basic Glenn Tinseth formula.
c21567bfd703 Final set the default utilisation to 20. Selecting another hop in a product now sets the new utilisation and bu_factor too. Removed experimental CO2 extract calculation and let it handle by the Tinseth formula. The Tinseth formula uses the Utilisation value in the final calculation. Moved the ISO extract formula for extract at bottling to the main toIBU function.
Michiel Broek <mbroek@mbse.eu>
parents: 373
diff changeset
435 * http://realbeer.com/hops/research.html
c21567bfd703 Final set the default utilisation to 20. Selecting another hop in a product now sets the new utilisation and bu_factor too. Removed experimental CO2 extract calculation and let it handle by the Tinseth formula. The Tinseth formula uses the Utilisation value in the final calculation. Moved the ISO extract formula for extract at bottling to the main toIBU function.
Michiel Broek <mbroek@mbse.eu>
parents: 373
diff changeset
436 *
c21567bfd703 Final set the default utilisation to 20. Selecting another hop in a product now sets the new utilisation and bu_factor too. Removed experimental CO2 extract calculation and let it handle by the Tinseth formula. The Tinseth formula uses the Utilisation value in the final calculation. Moved the ISO extract formula for extract at bottling to the main toIBU function.
Michiel Broek <mbroek@mbse.eu>
parents: 373
diff changeset
437 * kUtilisation was hardcoded as 4.15.
c21567bfd703 Final set the default utilisation to 20. Selecting another hop in a product now sets the new utilisation and bu_factor too. Removed experimental CO2 extract calculation and let it handle by the Tinseth formula. The Tinseth formula uses the Utilisation value in the final calculation. Moved the ISO extract formula for extract at bottling to the main toIBU function.
Michiel Broek <mbroek@mbse.eu>
parents: 373
diff changeset
438 * It is now a formula since we need variable Utilisation values per hop.
c21567bfd703 Final set the default utilisation to 20. Selecting another hop in a product now sets the new utilisation and bu_factor too. Removed experimental CO2 extract calculation and let it handle by the Tinseth formula. The Tinseth formula uses the Utilisation value in the final calculation. Moved the ISO extract formula for extract at bottling to the main toIBU function.
Michiel Broek <mbroek@mbse.eu>
parents: 373
diff changeset
439 * Default "normal" hops Utilisation is 20.
373
b02aca4e926c First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents: 356
diff changeset
440 */
375
c21567bfd703 Final set the default utilisation to 20. Selecting another hop in a product now sets the new utilisation and bu_factor too. Removed experimental CO2 extract calculation and let it handle by the Tinseth formula. The Tinseth formula uses the Utilisation value in the final calculation. Moved the ISO extract formula for extract at bottling to the main toIBU function.
Michiel Broek <mbroek@mbse.eu>
parents: 373
diff changeset
441 double kUtilisation = 83.0 / Utilisation;
339
2f3cfb983fcc Removed Garetz and Rager IBU calculations, we will only use Tinseth
Michiel Broek <mbroek@mbse.eu>
parents: 337
diff changeset
442 double AddedAlphaAcids = (alpha * mass * 1000) / Volume;
2f3cfb983fcc Removed Garetz and Rager IBU calculations, we will only use Tinseth
Michiel Broek <mbroek@mbse.eu>
parents: 337
diff changeset
443 double Bigness_factor = 1.65 * pow(0.000125, SG - 1);
375
c21567bfd703 Final set the default utilisation to 20. Selecting another hop in a product now sets the new utilisation and bu_factor too. Removed experimental CO2 extract calculation and let it handle by the Tinseth formula. The Tinseth formula uses the Utilisation value in the final calculation. Moved the ISO extract formula for extract at bottling to the main toIBU function.
Michiel Broek <mbroek@mbse.eu>
parents: 373
diff changeset
444 double BoilTime_factor1 = ((1 - exp(-0.04 * T1)) / kUtilisation);
c21567bfd703 Final set the default utilisation to 20. Selecting another hop in a product now sets the new utilisation and bu_factor too. Removed experimental CO2 extract calculation and let it handle by the Tinseth formula. The Tinseth formula uses the Utilisation value in the final calculation. Moved the ISO extract formula for extract at bottling to the main toIBU function.
Michiel Broek <mbroek@mbse.eu>
parents: 373
diff changeset
445 double BoilTime_factor2 = ((1 - exp(-0.04 * T2)) / kUtilisation);
380
8f5c03ed4321 Global setup added hop utilisation defaults, these are used by the hops editor. In the hops editor, changing the hop form sets the new default utilisation. Hide and show the time edit entry instead of setting it read-only. The new defaults are loaded at program startup. Changed the global setup for the new utilisation fields and dropped the obsolete factor fields. The toIBU formula doesn't use my_factor_* variables anymore, hop differences now come from the utilisation field per hop. The global database is updated to the new defaults.
Michiel Broek <mbroek@mbse.eu>
parents: 375
diff changeset
446 double ibu = Bigness_factor * (BoilTime_factor2 - BoilTime_factor1) * AddedAlphaAcids;
337
8133cdb19aa1 Added my_height global variable and edit in profile setup. This sets the height of the brewery above or below sealevel. Added calculations for the air pressure, boilpoint and IBU_reduction that all depend on the height. Currently not yet in use. Split out the real IBU calculation from the generic toIBU function. This has no effect on the results.
Michiel Broek <mbroek@mbse.eu>
parents: 336
diff changeset
447
454
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 453
diff changeset
448 #ifdef DEBUG_IBU
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 453
diff changeset
449 qDebug() << "TinsethIBU" << SG << Amount << Alpha << Volume << kUtilisation << Bigness_factor * (BoilTime_factor2 - BoilTime_factor1) << "ibu:" << ibu;
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 453
diff changeset
450 qDebug() << " boilIBU" << Form << SG << Volume << Amount << BoilTime_factor2 << BoilTime_factor1 << Alpha << "IBU:" << ibu;
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 453
diff changeset
451 #endif
337
8133cdb19aa1 Added my_height global variable and edit in profile setup. This sets the height of the brewery above or below sealevel. Added calculations for the air pressure, boilpoint and IBU_reduction that all depend on the height. Currently not yet in use. Split out the real IBU calculation from the generic toIBU function. This has no effect on the results.
Michiel Broek <mbroek@mbse.eu>
parents: 336
diff changeset
452 return ibu;
336
e97f9e87d94b IBU method names are now global.
Michiel Broek <mbroek@mbse.eu>
parents: 300
diff changeset
453 }
337
8133cdb19aa1 Added my_height global variable and edit in profile setup. This sets the height of the brewery above or below sealevel. Added calculations for the air pressure, boilpoint and IBU_reduction that all depend on the height. Currently not yet in use. Split out the real IBU calculation from the generic toIBU function. This has no effect on the results.
Michiel Broek <mbroek@mbse.eu>
parents: 336
diff changeset
454
102
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
455
373
b02aca4e926c First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents: 356
diff changeset
456 double Utils::toIBU(int Use, int Form, double preSG, double postSG, double Volume, double Amount, double Boiltime, double Alpha,
b02aca4e926c First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents: 356
diff changeset
457 int Method, double Whirlpool9, double Whirlpool7, double Whirlpool6, double Fulltime,
440
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
458 int Cooltype, double CoolTo79, double CoolLPM, double Utilisation, double BU_factor)
125
2e79e0975e58 Start hops table display. The calculated preboil_sg value is stored global in memory. Added calculations for IBU, hop flavour and aroma.
Michiel Broek <mbroek@mbse.eu>
parents: 102
diff changeset
459 {
344
9ffac162000c Setting mash hopping efficiency now between -95 and +50. Refresh all after changing the IBU method. Added own part for Mash Hopping. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 343
diff changeset
460 double ibu = 0.0;
440
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
461 double bp = boilPoint();
339
2f3cfb983fcc Removed Garetz and Rager IBU calculations, we will only use Tinseth
Michiel Broek <mbroek@mbse.eu>
parents: 337
diff changeset
462
344
9ffac162000c Setting mash hopping efficiency now between -95 and +50. Refresh all after changing the IBU method. Added own part for Mash Hopping. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 343
diff changeset
463 if (Use == HOP_USEAT_MASH) {
9ffac162000c Setting mash hopping efficiency now between -95 and +50. Refresh all after changing the IBU method. Added own part for Mash Hopping. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 343
diff changeset
464 /*
9ffac162000c Setting mash hopping efficiency now between -95 and +50. Refresh all after changing the IBU method. Added own part for Mash Hopping. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 343
diff changeset
465 * Mash hops. About -30% to -90% utilization. Is a global setting.
9ffac162000c Setting mash hopping efficiency now between -95 and +50. Refresh all after changing the IBU method. Added own part for Mash Hopping. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 343
diff changeset
466 * They count for 60 minutes, this is a fixed value.
9ffac162000c Setting mash hopping efficiency now between -95 and +50. Refresh all after changing the IBU method. Added own part for Mash Hopping. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 343
diff changeset
467 * Almost all these hops will be gone after removing the malt. From
9ffac162000c Setting mash hopping efficiency now between -95 and +50. Refresh all after changing the IBU method. Added own part for Mash Hopping. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 343
diff changeset
468 * pellets there may be some dust left, but that has minor effects.
9ffac162000c Setting mash hopping efficiency now between -95 and +50. Refresh all after changing the IBU method. Added own part for Mash Hopping. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 343
diff changeset
469 *
9ffac162000c Setting mash hopping efficiency now between -95 and +50. Refresh all after changing the IBU method. Added own part for Mash Hopping. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 343
diff changeset
470 * http://scottjanish.com/the-locksmith-utilizing-bioengineered-yeast-and-high-bound-thiol-precersour-hops-and-phantasm-powder-to-thiol-drive-beer/
9ffac162000c Setting mash hopping efficiency now between -95 and +50. Refresh all after changing the IBU method. Added own part for Mash Hopping. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 343
diff changeset
471 */
373
b02aca4e926c First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents: 356
diff changeset
472 ibu = TinsethIBU(Form, preSG, Volume, Amount, 0, 60, Alpha, Utilisation, BU_factor) * (1 + my_factor_mashhop / 100.0);
125
2e79e0975e58 Start hops table display. The calculated preboil_sg value is stored global in memory. Added calculations for IBU, hop flavour and aroma.
Michiel Broek <mbroek@mbse.eu>
parents: 102
diff changeset
473
344
9ffac162000c Setting mash hopping efficiency now between -95 and +50. Refresh all after changing the IBU method. Added own part for Mash Hopping. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 343
diff changeset
474 } else if ((Use == HOP_USEAT_FWH) || (Use == HOP_USEAT_BOIL)) {
9ffac162000c Setting mash hopping efficiency now between -95 and +50. Refresh all after changing the IBU method. Added own part for Mash Hopping. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 343
diff changeset
475 /*
9ffac162000c Setting mash hopping efficiency now between -95 and +50. Refresh all after changing the IBU method. Added own part for Mash Hopping. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 343
diff changeset
476 * IBU's from hops during FWH and boil.
9ffac162000c Setting mash hopping efficiency now between -95 and +50. Refresh all after changing the IBU method. Added own part for Mash Hopping. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 343
diff changeset
477 */
343
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
478 double boil_time = Fulltime;
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
479 if (Use == HOP_USEAT_BOIL)
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
480 boil_time = Boiltime;
373
b02aca4e926c First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents: 356
diff changeset
481 double fromSG = postSG - ((boil_time / Fulltime) * (postSG - preSG)); /* SG when this hop addition starts */
b02aca4e926c First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents: 356
diff changeset
482 double avgSG = (postSG + fromSG) / 2; /* Average SG during this addition */
b02aca4e926c First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents: 356
diff changeset
483 ibu = TinsethIBU(Form, avgSG, Volume, Amount, 0, boil_time, Alpha, Utilisation, BU_factor);
343
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
484
337
8133cdb19aa1 Added my_height global variable and edit in profile setup. This sets the height of the brewery above or below sealevel. Added calculations for the air pressure, boilpoint and IBU_reduction that all depend on the height. Currently not yet in use. Split out the real IBU calculation from the generic toIBU function. This has no effect on the results.
Michiel Broek <mbroek@mbse.eu>
parents: 336
diff changeset
485 /*
373
b02aca4e926c First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents: 356
diff changeset
486 * Correction for FWH
337
8133cdb19aa1 Added my_height global variable and edit in profile setup. This sets the height of the brewery above or below sealevel. Added calculations for the air pressure, boilpoint and IBU_reduction that all depend on the height. Currently not yet in use. Split out the real IBU calculation from the generic toIBU function. This has no effect on the results.
Michiel Broek <mbroek@mbse.eu>
parents: 336
diff changeset
487 */
8133cdb19aa1 Added my_height global variable and edit in profile setup. This sets the height of the brewery above or below sealevel. Added calculations for the air pressure, boilpoint and IBU_reduction that all depend on the height. Currently not yet in use. Split out the real IBU calculation from the generic toIBU function. This has no effect on the results.
Michiel Broek <mbroek@mbse.eu>
parents: 336
diff changeset
488 if (Use == HOP_USEAT_FWH) {
8133cdb19aa1 Added my_height global variable and edit in profile setup. This sets the height of the brewery above or below sealevel. Added calculations for the air pressure, boilpoint and IBU_reduction that all depend on the height. Currently not yet in use. Split out the real IBU calculation from the generic toIBU function. This has no effect on the results.
Michiel Broek <mbroek@mbse.eu>
parents: 336
diff changeset
489 ibu *= (1 + my_factor_fwh / 100.0);
8133cdb19aa1 Added my_height global variable and edit in profile setup. This sets the height of the brewery above or below sealevel. Added calculations for the air pressure, boilpoint and IBU_reduction that all depend on the height. Currently not yet in use. Split out the real IBU calculation from the generic toIBU function. This has no effect on the results.
Michiel Broek <mbroek@mbse.eu>
parents: 336
diff changeset
490 }
8133cdb19aa1 Added my_height global variable and edit in profile setup. This sets the height of the brewery above or below sealevel. Added calculations for the air pressure, boilpoint and IBU_reduction that all depend on the height. Currently not yet in use. Split out the real IBU calculation from the generic toIBU function. This has no effect on the results.
Michiel Broek <mbroek@mbse.eu>
parents: 336
diff changeset
491
343
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
492 if (Method > 0) {
440
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
493 /*
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
494 * Extra IBU's during flameout, chilling, hopstands for hops added during boil or first wort.
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
495 */
343
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
496 double nibu = ibu;
440
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
497 if (Use == HOP_USEAT_BOIL) /* Correct for brewery height above sealevel */
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
498 nibu *= IBU_reduction(bp);
343
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
499
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
500 /*
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
501 * Flameout, currently fixed 1 minute.
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
502 */
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
503 double flameout_time = 1;
373
b02aca4e926c First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents: 356
diff changeset
504 double fibu = TinsethIBU(Form, postSG, Volume, Amount, boil_time, boil_time + flameout_time, Alpha, Utilisation, BU_factor);
440
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
505 fibu *= IBU_reduction(bp - 0.5); /* Boilpoint minus 0.5 degree */
454
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 453
diff changeset
506 #ifdef DEBUG_IBU
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 453
diff changeset
507 qDebug() << "during flameout" << fibu << bp;
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 453
diff changeset
508 #endif
343
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
509 nibu += fibu;
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
510
440
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
511 if ((Cooltype == CHILLER_TYPE_IMMERSION || Cooltype == CHILLER_TYPE_AUBAINMARIE || Cooltype == CHILLER_TYPE_NOCHILL) && CoolTo79 > 0) {
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
512 /*
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
513 * Direct wort chilling, calculate the IBU's when chilling down to 79 degrees.
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
514 */
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
515 double cibu = 0, tibu;
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
516 for (int i = 1; i < int(CoolTo79); i++) {
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
517 tibu = TinsethIBU(Form, postSG, Volume, Amount, boil_time + flameout_time + i, boil_time + flameout_time + i + 1, Alpha, Utilisation, BU_factor);
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
518 tibu *= IBU_reduction((bp - 1) - (i * ((bp - 80) / CoolTo79)));
454
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 453
diff changeset
519 #ifdef DEBUG_IBU
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 453
diff changeset
520 qDebug() << " chill" << i << "time" << boil_time + flameout_time + i << "temp" << (bp - 1) - (i * ((bp - 80) / CoolTo79)) << "ibu" << tibu;
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 453
diff changeset
521 #endif
440
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
522 cibu += tibu;
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
523 }
454
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 453
diff changeset
524 #ifdef DEBUG_IBU
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 453
diff changeset
525 qDebug() << " immersion" << cibu;
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 453
diff changeset
526 #endif
440
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
527 nibu += cibu;
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
528 }
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
529
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
530 if (Cooltype == CHILLER_TYPE_COUNTERFLOW && CoolLPM > 0) {
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
531 /*
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
532 * Counterflow chilling, calculate the IBU's isomerized in the kettle during transfer the hot wort to the chiller.
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
533 */
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
534 double cibu = 0, tibu, V, A;
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
535 int steps = trunc(Volume / CoolLPM);
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
536 for (int i = 1; i <= steps; i++) {
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
537 V = Volume - (i * CoolLPM);
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
538 A = Amount - (i * (Amount / steps));
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
539 tibu = TinsethIBU(Form, postSG, V, A, boil_time + flameout_time + i, boil_time + flameout_time + i + 1, Alpha, Utilisation, BU_factor);
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
540 /*
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
541 * Correction for the natural cooling of the wort in the kettle.
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
542 * Asume 0.1 degree per minute.
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
543 */
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
544 tibu *= IBU_reduction((bp - 1) - (i * 0.1));
454
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 453
diff changeset
545 #ifdef DEBUG_IBU
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 453
diff changeset
546 qDebug() << " chill" << i << steps << "left" << V << A << "time" << boil_time + flameout_time + i << "ibu" << tibu;
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 453
diff changeset
547 #endif
440
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
548 cibu += tibu;
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
549 }
454
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 453
diff changeset
550 #ifdef DEBUG_IBU
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 453
diff changeset
551 qDebug() << " counterflow" << cibu;
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 453
diff changeset
552 #endif
440
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
553 nibu += cibu;
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
554 }
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
555
343
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
556 /*
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
557 * Hopstands, this boil hop adds some IBU's too.
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
558 */
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
559 if (Whirlpool9) {
373
b02aca4e926c First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents: 356
diff changeset
560 double wibu9 = TinsethIBU(Form, postSG, Volume, Amount, boil_time + flameout_time, boil_time + flameout_time + Whirlpool9, Alpha, Utilisation, BU_factor);
343
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
561 wibu9 *= IBU_reduction(87.0);
454
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 453
diff changeset
562 #ifdef DEBUG_IBU
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 453
diff changeset
563 qDebug() << "during whirlpool9" << wibu9;
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 453
diff changeset
564 #endif
343
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
565 nibu += wibu9;
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
566 }
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
567 if (Whirlpool7) {
373
b02aca4e926c First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents: 356
diff changeset
568 double wibu7 = TinsethIBU(Form, postSG, Volume, Amount, boil_time + flameout_time, boil_time + flameout_time + Whirlpool7, Alpha, Utilisation, BU_factor);
343
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
569 wibu7 *= IBU_reduction(74.0);
454
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 453
diff changeset
570 #ifdef DEBUG_IBU
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 453
diff changeset
571 qDebug() << "during whirlpool7" << wibu7;
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 453
diff changeset
572 #endif
343
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
573 nibu += wibu7;
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
574 }
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
575 if (Whirlpool6) {
373
b02aca4e926c First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents: 356
diff changeset
576 double wibu6 = TinsethIBU(Form, postSG, Volume, Amount, boil_time + flameout_time, boil_time + flameout_time + Whirlpool6, Alpha, Utilisation, BU_factor);
343
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
577 wibu6 *= IBU_reduction(63.0);
454
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 453
diff changeset
578 #ifdef DEBUG_IBU
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 453
diff changeset
579 qDebug() << "during whirlpool6" << wibu6;
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 453
diff changeset
580 #endif
343
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
581 nibu += wibu6;
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
582 }
454
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 453
diff changeset
583 #ifdef DEBUG_IBU
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 453
diff changeset
584 qDebug() << "Old IBU" << ibu << "New IBU" << nibu;
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 453
diff changeset
585 #endif
343
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
586 ibu = nibu;
337
8133cdb19aa1 Added my_height global variable and edit in profile setup. This sets the height of the brewery above or below sealevel. Added calculations for the air pressure, boilpoint and IBU_reduction that all depend on the height. Currently not yet in use. Split out the real IBU calculation from the generic toIBU function. This has no effect on the results.
Michiel Broek <mbroek@mbse.eu>
parents: 336
diff changeset
587 }
339
2f3cfb983fcc Removed Garetz and Rager IBU calculations, we will only use Tinseth
Michiel Broek <mbroek@mbse.eu>
parents: 337
diff changeset
588
343
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
589 } else if ((Use == HOP_USEAT_AROMA) && (Method > 0)) {
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
590 /*
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
591 * At flameout, and only using extended calculation.
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
592 */
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
593 double flameout_time = 1;
373
b02aca4e926c First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents: 356
diff changeset
594 ibu = TinsethIBU(Form, postSG, Volume, Amount, 0, flameout_time, Alpha, Utilisation, BU_factor);
440
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
595 ibu *= IBU_reduction(bp - 0.5);
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
596
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
597 if ((Cooltype == CHILLER_TYPE_IMMERSION || Cooltype == CHILLER_TYPE_AUBAINMARIE || Cooltype == CHILLER_TYPE_NOCHILL) && CoolTo79 > 0) {
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
598 /*
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
599 * Direct wort chilling, calculate the IBU's when chilling down to 79 degrees.
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
600 */
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
601 double cibu = 0, tibu;
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
602 for (int i = 1; i < int(CoolTo79); i++) {
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
603 tibu = TinsethIBU(Form, postSG, Volume, Amount, flameout_time + i, flameout_time + i + 1, Alpha, Utilisation, BU_factor);
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
604 tibu *= IBU_reduction((bp - 1) - (i * ((bp - 80) / CoolTo79)));
454
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 453
diff changeset
605 #ifdef DEBUG_IBU
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 453
diff changeset
606 qDebug() << " chill" << i << "time" << flameout_time + i << "temp" << (bp - 1) - (i * ((bp - 80) / CoolTo79)) << "ibu" << tibu;
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 453
diff changeset
607 #endif
440
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
608 cibu += tibu;
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
609 }
454
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 453
diff changeset
610 #ifdef DEBUG_IBU
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 453
diff changeset
611 qDebug() << " immersion" << cibu;
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 453
diff changeset
612 #endif
440
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
613 ibu += cibu;
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
614 }
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
615
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
616 if (Cooltype == CHILLER_TYPE_COUNTERFLOW && CoolLPM > 0) {
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
617 /*
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
618 * Counterflow chilling, calculate the IBU's isomerized in the kettle during transfer the hot wort to the chiller.
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
619 */
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
620 double cibu = 0, tibu, V, A;
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
621 int steps = trunc(Volume / CoolLPM);
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
622 for (int i = 1; i <= steps; i++) {
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
623 V = Volume - (i * CoolLPM);
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
624 A = Amount - (i * (Amount / steps));
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
625 tibu = TinsethIBU(Form, postSG, V, A, flameout_time + i, flameout_time + i + 1, Alpha, Utilisation, BU_factor);
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
626 /*
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
627 * Correction for the natural cooling of the wort in the kettle.
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
628 * Asume 0.1 degree per minute.
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
629 */
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
630 tibu *= IBU_reduction((bp - 1) - (i * 0.1));
454
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 453
diff changeset
631 #ifdef DEBUG_IBU
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 453
diff changeset
632 qDebug() << " chill" << i << steps << "left" << V << A << "time" << flameout_time + i << "ibu" << tibu;
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 453
diff changeset
633 #endif
440
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
634 cibu += tibu;
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
635 }
454
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 453
diff changeset
636 #ifdef DEBUG_IBU
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 453
diff changeset
637 qDebug() << " counterflow" << cibu;
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 453
diff changeset
638 #endif
440
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
639 ibu += cibu;
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
640 }
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
641
343
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
642 /*
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
643 * Hopstands, this flameout hop adds some IBU's too.
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
644 */
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
645 if (Whirlpool9) {
373
b02aca4e926c First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents: 356
diff changeset
646 double wibu9 = TinsethIBU(Form, postSG, Volume, Amount, flameout_time, flameout_time + Whirlpool9, Alpha, Utilisation, BU_factor);
343
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
647 wibu9 *= IBU_reduction(87.0);
454
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 453
diff changeset
648 #ifdef DEBUG_IBU
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 453
diff changeset
649 qDebug() << "during whirlpool9" << wibu9;
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 453
diff changeset
650 #endif
343
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
651 ibu += wibu9;
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
652 }
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
653 if (Whirlpool7) {
373
b02aca4e926c First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents: 356
diff changeset
654 double wibu7 = TinsethIBU(Form, postSG, Volume, Amount, flameout_time, flameout_time + Whirlpool7, Alpha, Utilisation, BU_factor);
343
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
655 wibu7 *= IBU_reduction(74.0);
454
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 453
diff changeset
656 #ifdef DEBUG_IBU
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 453
diff changeset
657 qDebug() << "during whirlpool7" << wibu7;
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 453
diff changeset
658 #endif
343
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
659 ibu += wibu7;
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
660 }
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
661 if (Whirlpool6) {
373
b02aca4e926c First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents: 356
diff changeset
662 double wibu6 = TinsethIBU(Form, postSG, Volume, Amount, flameout_time, flameout_time + Whirlpool6, Alpha, Utilisation, BU_factor);
343
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
663 wibu6 *= IBU_reduction(63.0);
454
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 453
diff changeset
664 #ifdef DEBUG_IBU
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 453
diff changeset
665 qDebug() << "during whirlpool6" << wibu6;
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 453
diff changeset
666 #endif
343
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
667 ibu += wibu6;
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
668 }
337
8133cdb19aa1 Added my_height global variable and edit in profile setup. This sets the height of the brewery above or below sealevel. Added calculations for the air pressure, boilpoint and IBU_reduction that all depend on the height. Currently not yet in use. Split out the real IBU calculation from the generic toIBU function. This has no effect on the results.
Michiel Broek <mbroek@mbse.eu>
parents: 336
diff changeset
669
343
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
670 } else if ((Use == HOP_USEAT_WHIRLPOOL) && (Method > 0)) {
337
8133cdb19aa1 Added my_height global variable and edit in profile setup. This sets the height of the brewery above or below sealevel. Added calculations for the air pressure, boilpoint and IBU_reduction that all depend on the height. Currently not yet in use. Split out the real IBU calculation from the generic toIBU function. This has no effect on the results.
Michiel Broek <mbroek@mbse.eu>
parents: 336
diff changeset
671 /*
343
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
672 * Hopstands.
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
673 */
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
674 if (Whirlpool9) {
373
b02aca4e926c First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents: 356
diff changeset
675 double wibu9 = TinsethIBU(Form, postSG, Volume, Amount, 0, Whirlpool9, Alpha, Utilisation, BU_factor);
343
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
676 wibu9 *= IBU_reduction(87.0);
454
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 453
diff changeset
677 #ifdef DEBUG_IBU
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 453
diff changeset
678 qDebug() << "during whirlpool9" << wibu9;
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 453
diff changeset
679 #endif
343
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
680 ibu = wibu9;
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
681 }
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
682 if (Whirlpool7) {
373
b02aca4e926c First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents: 356
diff changeset
683 double wibu7 = TinsethIBU(Form, postSG, Volume, Amount, 0, Whirlpool7, Alpha, Utilisation, BU_factor);
343
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
684 wibu7 *= IBU_reduction(74.0);
454
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 453
diff changeset
685 #ifdef DEBUG_IBU
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 453
diff changeset
686 qDebug() << "during whirlpool7" << wibu7;
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 453
diff changeset
687 #endif
343
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
688 ibu = wibu7;
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
689 }
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
690 if (Whirlpool6) {
373
b02aca4e926c First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents: 356
diff changeset
691 double wibu6 = TinsethIBU(Form, postSG, Volume, Amount, 0, Whirlpool6, Alpha, Utilisation, BU_factor);
343
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
692 wibu6 *= IBU_reduction(63.0);
454
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 453
diff changeset
693 #ifdef DEBUG_IBU
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 453
diff changeset
694 qDebug() << "during whirlpool6" << wibu6;
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 453
diff changeset
695 #endif
343
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
696 ibu = wibu6;
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
697 }
373
b02aca4e926c First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents: 356
diff changeset
698 } else if (Use == HOP_USEAT_BOTTLING) {
b02aca4e926c First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents: 356
diff changeset
699 /*
b02aca4e926c First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents: 356
diff changeset
700 * Isomerized hop extracts to use at bottling.
b02aca4e926c First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents: 356
diff changeset
701 * Assume 10% volume is lost during fermentation and transfers.
b02aca4e926c First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents: 356
diff changeset
702 */
375
c21567bfd703 Final set the default utilisation to 20. Selecting another hop in a product now sets the new utilisation and bu_factor too. Removed experimental CO2 extract calculation and let it handle by the Tinseth formula. The Tinseth formula uses the Utilisation value in the final calculation. Moved the ISO extract formula for extract at bottling to the main toIBU function.
Michiel Broek <mbroek@mbse.eu>
parents: 373
diff changeset
703 if (Form == HOP_FORMS_ISOEXTRACT) {
c21567bfd703 Final set the default utilisation to 20. Selecting another hop in a product now sets the new utilisation and bu_factor too. Removed experimental CO2 extract calculation and let it handle by the Tinseth formula. The Tinseth formula uses the Utilisation value in the final calculation. Moved the ISO extract formula for extract at bottling to the main toIBU function.
Michiel Broek <mbroek@mbse.eu>
parents: 373
diff changeset
704 /*
c21567bfd703 Final set the default utilisation to 20. Selecting another hop in a product now sets the new utilisation and bu_factor too. Removed experimental CO2 extract calculation and let it handle by the Tinseth formula. The Tinseth formula uses the Utilisation value in the final calculation. Moved the ISO extract formula for extract at bottling to the main toIBU function.
Michiel Broek <mbroek@mbse.eu>
parents: 373
diff changeset
705 * ISO-alpha-extract hops, Tetra etc.
c21567bfd703 Final set the default utilisation to 20. Selecting another hop in a product now sets the new utilisation and bu_factor too. Removed experimental CO2 extract calculation and let it handle by the Tinseth formula. The Tinseth formula uses the Utilisation value in the final calculation. Moved the ISO extract formula for extract at bottling to the main toIBU function.
Michiel Broek <mbroek@mbse.eu>
parents: 373
diff changeset
706 */
c21567bfd703 Final set the default utilisation to 20. Selecting another hop in a product now sets the new utilisation and bu_factor too. Removed experimental CO2 extract calculation and let it handle by the Tinseth formula. The Tinseth formula uses the Utilisation value in the final calculation. Moved the ISO extract formula for extract at bottling to the main toIBU function.
Michiel Broek <mbroek@mbse.eu>
parents: 373
diff changeset
707 double dosageHl = ((100.0 / Utilisation) * (100.0 / Alpha) * 0.001) / BU_factor; // IBU per liter
c21567bfd703 Final set the default utilisation to 20. Selecting another hop in a product now sets the new utilisation and bu_factor too. Removed experimental CO2 extract calculation and let it handle by the Tinseth formula. The Tinseth formula uses the Utilisation value in the final calculation. Moved the ISO extract formula for extract at bottling to the main toIBU function.
Michiel Broek <mbroek@mbse.eu>
parents: 373
diff changeset
708 ibu = (Amount * 1000.0) / (dosageHl * Volume * 0.9);
c21567bfd703 Final set the default utilisation to 20. Selecting another hop in a product now sets the new utilisation and bu_factor too. Removed experimental CO2 extract calculation and let it handle by the Tinseth formula. The Tinseth formula uses the Utilisation value in the final calculation. Moved the ISO extract formula for extract at bottling to the main toIBU function.
Michiel Broek <mbroek@mbse.eu>
parents: 373
diff changeset
709 qDebug() << "ISO extract" << Amount << Alpha << Volume * 0.9 << Utilisation << BU_factor << "ibu:" << ibu;
c21567bfd703 Final set the default utilisation to 20. Selecting another hop in a product now sets the new utilisation and bu_factor too. Removed experimental CO2 extract calculation and let it handle by the Tinseth formula. The Tinseth formula uses the Utilisation value in the final calculation. Moved the ISO extract formula for extract at bottling to the main toIBU function.
Michiel Broek <mbroek@mbse.eu>
parents: 373
diff changeset
710 }
125
2e79e0975e58 Start hops table display. The calculated preboil_sg value is stored global in memory. Added calculations for IBU, hop flavour and aroma.
Michiel Broek <mbroek@mbse.eu>
parents: 102
diff changeset
711 }
2e79e0975e58 Start hops table display. The calculated preboil_sg value is stored global in memory. Added calculations for IBU, hop flavour and aroma.
Michiel Broek <mbroek@mbse.eu>
parents: 102
diff changeset
712
344
9ffac162000c Setting mash hopping efficiency now between -95 and +50. Refresh all after changing the IBU method. Added own part for Mash Hopping. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 343
diff changeset
713 double rc = round(ibu * 1000.0) / 1000.0;
343
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
714
454
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 453
diff changeset
715 #ifdef DEBUG_IBU
440
349c0c5bd512 Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
716 qDebug() << "toIBU" << Use << Form << preSG << postSG << Volume << Amount << Boiltime << Alpha << Method << Whirlpool9 << Whirlpool7 << Whirlpool6 << Fulltime << Cooltype << CoolTo79 << CoolLPM << Utilisation << BU_factor << "rc:" << rc;
454
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 453
diff changeset
717 #endif
343
67e645b9d23f Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
Michiel Broek <mbroek@mbse.eu>
parents: 342
diff changeset
718 return rc;
125
2e79e0975e58 Start hops table display. The calculated preboil_sg value is stored global in memory. Added calculations for IBU, hop flavour and aroma.
Michiel Broek <mbroek@mbse.eu>
parents: 102
diff changeset
719 }
2e79e0975e58 Start hops table display. The calculated preboil_sg value is stored global in memory. Added calculations for IBU, hop flavour and aroma.
Michiel Broek <mbroek@mbse.eu>
parents: 102
diff changeset
720
2e79e0975e58 Start hops table display. The calculated preboil_sg value is stored global in memory. Added calculations for IBU, hop flavour and aroma.
Michiel Broek <mbroek@mbse.eu>
parents: 102
diff changeset
721
373
b02aca4e926c First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents: 356
diff changeset
722 double Utils::hopFlavourContribution(double bt, double vol, int use, double amount, int form)
125
2e79e0975e58 Start hops table display. The calculated preboil_sg value is stored global in memory. Added calculations for IBU, hop flavour and aroma.
Michiel Broek <mbroek@mbse.eu>
parents: 102
diff changeset
723 {
2e79e0975e58 Start hops table display. The calculated preboil_sg value is stored global in memory. Added calculations for IBU, hop flavour and aroma.
Michiel Broek <mbroek@mbse.eu>
parents: 102
diff changeset
724 double result;
2e79e0975e58 Start hops table display. The calculated preboil_sg value is stored global in memory. Added calculations for IBU, hop flavour and aroma.
Michiel Broek <mbroek@mbse.eu>
parents: 102
diff changeset
725
300
2a97905cb637 Added hop co2 extract form. Added hop add at bottling needed for iso and tetra hop.
Michiel Broek <mbroek@mbse.eu>
parents: 281
diff changeset
726 if (use == HOP_USEAT_WHIRLPOOL || use == HOP_USEAT_DRY_HOP)
125
2e79e0975e58 Start hops table display. The calculated preboil_sg value is stored global in memory. Added calculations for IBU, hop flavour and aroma.
Michiel Broek <mbroek@mbse.eu>
parents: 102
diff changeset
727 return 0;
300
2a97905cb637 Added hop co2 extract form. Added hop add at bottling needed for iso and tetra hop.
Michiel Broek <mbroek@mbse.eu>
parents: 281
diff changeset
728 if (use == HOP_USEAT_FWH) {
125
2e79e0975e58 Start hops table display. The calculated preboil_sg value is stored global in memory. Added calculations for IBU, hop flavour and aroma.
Michiel Broek <mbroek@mbse.eu>
parents: 102
diff changeset
729 result = 0.15; // assume 15% flavourcontribution for fwh
2e79e0975e58 Start hops table display. The calculated preboil_sg value is stored global in memory. Added calculations for IBU, hop flavour and aroma.
Michiel Broek <mbroek@mbse.eu>
parents: 102
diff changeset
730 } else if (bt > 50) {
2e79e0975e58 Start hops table display. The calculated preboil_sg value is stored global in memory. Added calculations for IBU, hop flavour and aroma.
Michiel Broek <mbroek@mbse.eu>
parents: 102
diff changeset
731 result = 0.10; // assume 10% flavourcontribution as a minimum
2e79e0975e58 Start hops table display. The calculated preboil_sg value is stored global in memory. Added calculations for IBU, hop flavour and aroma.
Michiel Broek <mbroek@mbse.eu>
parents: 102
diff changeset
732 } else {
2e79e0975e58 Start hops table display. The calculated preboil_sg value is stored global in memory. Added calculations for IBU, hop flavour and aroma.
Michiel Broek <mbroek@mbse.eu>
parents: 102
diff changeset
733 result = 15.25 / (6 * sqrt(2 * 3.1416)) * exp(-0.5 * pow((bt - 21.0) / 6.0, 2.0));
2e79e0975e58 Start hops table display. The calculated preboil_sg value is stored global in memory. Added calculations for IBU, hop flavour and aroma.
Michiel Broek <mbroek@mbse.eu>
parents: 102
diff changeset
734 if (result < 0.10)
2e79e0975e58 Start hops table display. The calculated preboil_sg value is stored global in memory. Added calculations for IBU, hop flavour and aroma.
Michiel Broek <mbroek@mbse.eu>
parents: 102
diff changeset
735 result = 0.10; // assume 10% flavourcontribution as a minimum
2e79e0975e58 Start hops table display. The calculated preboil_sg value is stored global in memory. Added calculations for IBU, hop flavour and aroma.
Michiel Broek <mbroek@mbse.eu>
parents: 102
diff changeset
736 }
2e79e0975e58 Start hops table display. The calculated preboil_sg value is stored global in memory. Added calculations for IBU, hop flavour and aroma.
Michiel Broek <mbroek@mbse.eu>
parents: 102
diff changeset
737 return (result * amount * 1000.0) / vol;
2e79e0975e58 Start hops table display. The calculated preboil_sg value is stored global in memory. Added calculations for IBU, hop flavour and aroma.
Michiel Broek <mbroek@mbse.eu>
parents: 102
diff changeset
738 }
2e79e0975e58 Start hops table display. The calculated preboil_sg value is stored global in memory. Added calculations for IBU, hop flavour and aroma.
Michiel Broek <mbroek@mbse.eu>
parents: 102
diff changeset
739
2e79e0975e58 Start hops table display. The calculated preboil_sg value is stored global in memory. Added calculations for IBU, hop flavour and aroma.
Michiel Broek <mbroek@mbse.eu>
parents: 102
diff changeset
740
373
b02aca4e926c First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents: 356
diff changeset
741 double Utils::hopAromaContribution(double bt, double vol, int use, double amount, int form)
125
2e79e0975e58 Start hops table display. The calculated preboil_sg value is stored global in memory. Added calculations for IBU, hop flavour and aroma.
Michiel Broek <mbroek@mbse.eu>
parents: 102
diff changeset
742 {
2e79e0975e58 Start hops table display. The calculated preboil_sg value is stored global in memory. Added calculations for IBU, hop flavour and aroma.
Michiel Broek <mbroek@mbse.eu>
parents: 102
diff changeset
743 double result = 0.0;
373
b02aca4e926c First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents: 356
diff changeset
744 double factor = 1.0;
b02aca4e926c First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents: 356
diff changeset
745
b02aca4e926c First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents: 356
diff changeset
746 if (form == HOP_FORMS_CRYO)
b02aca4e926c First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents: 356
diff changeset
747 factor = 2.0;
125
2e79e0975e58 Start hops table display. The calculated preboil_sg value is stored global in memory. Added calculations for IBU, hop flavour and aroma.
Michiel Broek <mbroek@mbse.eu>
parents: 102
diff changeset
748
300
2a97905cb637 Added hop co2 extract form. Added hop add at bottling needed for iso and tetra hop.
Michiel Broek <mbroek@mbse.eu>
parents: 281
diff changeset
749 if (use == HOP_USEAT_DRY_HOP) {
125
2e79e0975e58 Start hops table display. The calculated preboil_sg value is stored global in memory. Added calculations for IBU, hop flavour and aroma.
Michiel Broek <mbroek@mbse.eu>
parents: 102
diff changeset
750 result = 1.33;
300
2a97905cb637 Added hop co2 extract form. Added hop add at bottling needed for iso and tetra hop.
Michiel Broek <mbroek@mbse.eu>
parents: 281
diff changeset
751 } else if (use == HOP_USEAT_WHIRLPOOL) {
125
2e79e0975e58 Start hops table display. The calculated preboil_sg value is stored global in memory. Added calculations for IBU, hop flavour and aroma.
Michiel Broek <mbroek@mbse.eu>
parents: 102
diff changeset
752 if (bt > 30)
2e79e0975e58 Start hops table display. The calculated preboil_sg value is stored global in memory. Added calculations for IBU, hop flavour and aroma.
Michiel Broek <mbroek@mbse.eu>
parents: 102
diff changeset
753 bt = 30; // Max 30 minutes
2e79e0975e58 Start hops table display. The calculated preboil_sg value is stored global in memory. Added calculations for IBU, hop flavour and aroma.
Michiel Broek <mbroek@mbse.eu>
parents: 102
diff changeset
754 result = 0.62 * bt / 30.0;
2e79e0975e58 Start hops table display. The calculated preboil_sg value is stored global in memory. Added calculations for IBU, hop flavour and aroma.
Michiel Broek <mbroek@mbse.eu>
parents: 102
diff changeset
755 } else if (bt > 20) {
2e79e0975e58 Start hops table display. The calculated preboil_sg value is stored global in memory. Added calculations for IBU, hop flavour and aroma.
Michiel Broek <mbroek@mbse.eu>
parents: 102
diff changeset
756 result = 0.0;
2e79e0975e58 Start hops table display. The calculated preboil_sg value is stored global in memory. Added calculations for IBU, hop flavour and aroma.
Michiel Broek <mbroek@mbse.eu>
parents: 102
diff changeset
757 } else if (bt > 7.5) {
2e79e0975e58 Start hops table display. The calculated preboil_sg value is stored global in memory. Added calculations for IBU, hop flavour and aroma.
Michiel Broek <mbroek@mbse.eu>
parents: 102
diff changeset
758 result = 10.03 / (4 * sqrt(2 * 3.1416)) * exp(-0.5 * pow((bt - 7.5) / 4.0, 2.0));
300
2a97905cb637 Added hop co2 extract form. Added hop add at bottling needed for iso and tetra hop.
Michiel Broek <mbroek@mbse.eu>
parents: 281
diff changeset
759 } else if (use == HOP_USEAT_BOIL) { // Boil
125
2e79e0975e58 Start hops table display. The calculated preboil_sg value is stored global in memory. Added calculations for IBU, hop flavour and aroma.
Michiel Broek <mbroek@mbse.eu>
parents: 102
diff changeset
760 result = 1;
300
2a97905cb637 Added hop co2 extract form. Added hop add at bottling needed for iso and tetra hop.
Michiel Broek <mbroek@mbse.eu>
parents: 281
diff changeset
761 } else if (use == HOP_USEAT_AROMA) { // Aroma
125
2e79e0975e58 Start hops table display. The calculated preboil_sg value is stored global in memory. Added calculations for IBU, hop flavour and aroma.
Michiel Broek <mbroek@mbse.eu>
parents: 102
diff changeset
762 result = 1.2;
2e79e0975e58 Start hops table display. The calculated preboil_sg value is stored global in memory. Added calculations for IBU, hop flavour and aroma.
Michiel Broek <mbroek@mbse.eu>
parents: 102
diff changeset
763 }
373
b02aca4e926c First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents: 356
diff changeset
764 return (result * amount * factor * 1000.0) / vol;
125
2e79e0975e58 Start hops table display. The calculated preboil_sg value is stored global in memory. Added calculations for IBU, hop flavour and aroma.
Michiel Broek <mbroek@mbse.eu>
parents: 102
diff changeset
765 }
2e79e0975e58 Start hops table display. The calculated preboil_sg value is stored global in memory. Added calculations for IBU, hop flavour and aroma.
Michiel Broek <mbroek@mbse.eu>
parents: 102
diff changeset
766
2e79e0975e58 Start hops table display. The calculated preboil_sg value is stored global in memory. Added calculations for IBU, hop flavour and aroma.
Michiel Broek <mbroek@mbse.eu>
parents: 102
diff changeset
767
134
5099df8ba6c6 Moved the mix function to Utils. Added some calculations to Utils. Added defines to global.h.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
768 double Utils::mix(double v1, double v2, double c1, double c2)
5099df8ba6c6 Moved the mix function to Utils. Added some calculations to Utils. Added defines to global.h.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
769 {
5099df8ba6c6 Moved the mix function to Utils. Added some calculations to Utils. Added defines to global.h.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
770 if ((v1 + v2) > 0) {
5099df8ba6c6 Moved the mix function to Utils. Added some calculations to Utils. Added defines to global.h.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
771 return ((v1 * c1) + (v2 * c2)) / (v1 + v2);
5099df8ba6c6 Moved the mix function to Utils. Added some calculations to Utils. Added defines to global.h.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
772 }
5099df8ba6c6 Moved the mix function to Utils. Added some calculations to Utils. Added defines to global.h.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
773 return 0;
5099df8ba6c6 Moved the mix function to Utils. Added some calculations to Utils. Added defines to global.h.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
774 }
5099df8ba6c6 Moved the mix function to Utils. Added some calculations to Utils. Added defines to global.h.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
775
5099df8ba6c6 Moved the mix function to Utils. Added some calculations to Utils. Added defines to global.h.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
776
350
37b3c690b02c Added calculation preboild pH in recipes. Added water hardness and residual alkalinity calculations in the water tab.
Michiel Broek <mbroek@mbse.eu>
parents: 344
diff changeset
777 double Utils::Hardness(double calcium, double magnesium)
37b3c690b02c Added calculation preboild pH in recipes. Added water hardness and residual alkalinity calculations in the water tab.
Michiel Broek <mbroek@mbse.eu>
parents: 344
diff changeset
778 {
356
f60f5a1fece9 Made the Hardness function more precise. Removed RA_ppm function, was doubles with ResidualAlkalinity. Added RA_CaCO3 and Bicarbonate functions.
Michiel Broek <mbroek@mbse.eu>
parents: 350
diff changeset
779 return 2.497 * calcium + 4.164 * magnesium;
350
37b3c690b02c Added calculation preboild pH in recipes. Added water hardness and residual alkalinity calculations in the water tab.
Michiel Broek <mbroek@mbse.eu>
parents: 344
diff changeset
780 }
37b3c690b02c Added calculation preboild pH in recipes. Added water hardness and residual alkalinity calculations in the water tab.
Michiel Broek <mbroek@mbse.eu>
parents: 344
diff changeset
781
37b3c690b02c Added calculation preboild pH in recipes. Added water hardness and residual alkalinity calculations in the water tab.
Michiel Broek <mbroek@mbse.eu>
parents: 344
diff changeset
782
356
f60f5a1fece9 Made the Hardness function more precise. Removed RA_ppm function, was doubles with ResidualAlkalinity. Added RA_CaCO3 and Bicarbonate functions.
Michiel Broek <mbroek@mbse.eu>
parents: 350
diff changeset
783 double Utils::Bicarbonate(double total_alkalinity, double ph)
350
37b3c690b02c Added calculation preboild pH in recipes. Added water hardness and residual alkalinity calculations in the water tab.
Michiel Broek <mbroek@mbse.eu>
parents: 344
diff changeset
784 {
356
f60f5a1fece9 Made the Hardness function more precise. Removed RA_ppm function, was doubles with ResidualAlkalinity. Added RA_CaCO3 and Bicarbonate functions.
Michiel Broek <mbroek@mbse.eu>
parents: 350
diff changeset
785 return (total_alkalinity / (1 + 2*pow(10, ph - 10.33)) * MMHCO3 /*61.016*/ / (MMCaCO3 / 2) /*50.043*/);
f60f5a1fece9 Made the Hardness function more precise. Removed RA_ppm function, was doubles with ResidualAlkalinity. Added RA_CaCO3 and Bicarbonate functions.
Michiel Broek <mbroek@mbse.eu>
parents: 350
diff changeset
786 }
f60f5a1fece9 Made the Hardness function more precise. Removed RA_ppm function, was doubles with ResidualAlkalinity. Added RA_CaCO3 and Bicarbonate functions.
Michiel Broek <mbroek@mbse.eu>
parents: 350
diff changeset
787
f60f5a1fece9 Made the Hardness function more precise. Removed RA_ppm function, was doubles with ResidualAlkalinity. Added RA_CaCO3 and Bicarbonate functions.
Michiel Broek <mbroek@mbse.eu>
parents: 350
diff changeset
788
f60f5a1fece9 Made the Hardness function more precise. Removed RA_ppm function, was doubles with ResidualAlkalinity. Added RA_CaCO3 and Bicarbonate functions.
Michiel Broek <mbroek@mbse.eu>
parents: 350
diff changeset
789 double Utils::RA_CaCO3(double bicarbonate, double carbonate, double calcium, double magnesium)
f60f5a1fece9 Made the Hardness function more precise. Removed RA_ppm function, was doubles with ResidualAlkalinity. Added RA_CaCO3 and Bicarbonate functions.
Michiel Broek <mbroek@mbse.eu>
parents: 350
diff changeset
790 {
f60f5a1fece9 Made the Hardness function more precise. Removed RA_ppm function, was doubles with ResidualAlkalinity. Added RA_CaCO3 and Bicarbonate functions.
Michiel Broek <mbroek@mbse.eu>
parents: 350
diff changeset
791 return ((bicarbonate / MMHCO3) + (2*carbonate / MMCO3) - (2*calcium / MMCa)/3.5 - (2*magnesium / MMMg)/7) * 50;
350
37b3c690b02c Added calculation preboild pH in recipes. Added water hardness and residual alkalinity calculations in the water tab.
Michiel Broek <mbroek@mbse.eu>
parents: 344
diff changeset
792 }
37b3c690b02c Added calculation preboild pH in recipes. Added water hardness and residual alkalinity calculations in the water tab.
Michiel Broek <mbroek@mbse.eu>
parents: 344
diff changeset
793
37b3c690b02c Added calculation preboild pH in recipes. Added water hardness and residual alkalinity calculations in the water tab.
Michiel Broek <mbroek@mbse.eu>
parents: 344
diff changeset
794
134
5099df8ba6c6 Moved the mix function to Utils. Added some calculations to Utils. Added defines to global.h.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
795 double Utils::ResidualAlkalinity(double total_alkalinity, double calcium, double magnesium)
5099df8ba6c6 Moved the mix function to Utils. Added some calculations to Utils. Added defines to global.h.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
796 {
5099df8ba6c6 Moved the mix function to Utils. Added some calculations to Utils. Added defines to global.h.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
797 return total_alkalinity - (calcium / 1.4 + magnesium / 1.7);
5099df8ba6c6 Moved the mix function to Utils. Added some calculations to Utils. Added defines to global.h.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
798 }
5099df8ba6c6 Moved the mix function to Utils. Added some calculations to Utils. Added defines to global.h.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
799
5099df8ba6c6 Moved the mix function to Utils. Added some calculations to Utils. Added defines to global.h.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
800
5099df8ba6c6 Moved the mix function to Utils. Added some calculations to Utils. Added defines to global.h.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
801 double Utils::PartCO3(double pH)
5099df8ba6c6 Moved the mix function to Utils. Added some calculations to Utils. Added defines to global.h.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
802 {
135
e68b27ad8a40 Added dutch translations to the internal acids array. Added slot for calc_acid checkbox. Added more water calculations. The miscs amount fields now have two decimal digits. Show treated waters and good/bad indicators.
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
803 double H = pow(10.0, -pH);
e68b27ad8a40 Added dutch translations to the internal acids array. Added slot for calc_acid checkbox. Added more water calculations. The miscs amount fields now have two decimal digits. Show treated waters and good/bad indicators.
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
804 return 100.0 * Ka1 * Ka2 / (H * H + H * Ka1 + Ka1 * Ka2);
134
5099df8ba6c6 Moved the mix function to Utils. Added some calculations to Utils. Added defines to global.h.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
805 }
5099df8ba6c6 Moved the mix function to Utils. Added some calculations to Utils. Added defines to global.h.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
806
5099df8ba6c6 Moved the mix function to Utils. Added some calculations to Utils. Added defines to global.h.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
807
5099df8ba6c6 Moved the mix function to Utils. Added some calculations to Utils. Added defines to global.h.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
808 double Utils::PartHCO3(double pH)
5099df8ba6c6 Moved the mix function to Utils. Added some calculations to Utils. Added defines to global.h.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
809 {
135
e68b27ad8a40 Added dutch translations to the internal acids array. Added slot for calc_acid checkbox. Added more water calculations. The miscs amount fields now have two decimal digits. Show treated waters and good/bad indicators.
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
810 double H = pow(10.0, -pH);
e68b27ad8a40 Added dutch translations to the internal acids array. Added slot for calc_acid checkbox. Added more water calculations. The miscs amount fields now have two decimal digits. Show treated waters and good/bad indicators.
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
811 return 100.0 * Ka1 * H / (H * H + H * Ka1 + Ka1 * Ka2);
134
5099df8ba6c6 Moved the mix function to Utils. Added some calculations to Utils. Added defines to global.h.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
812 }
5099df8ba6c6 Moved the mix function to Utils. Added some calculations to Utils. Added defines to global.h.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
813
5099df8ba6c6 Moved the mix function to Utils. Added some calculations to Utils. Added defines to global.h.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
814
5099df8ba6c6 Moved the mix function to Utils. Added some calculations to Utils. Added defines to global.h.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
815 double Utils::Charge(double pH)
5099df8ba6c6 Moved the mix function to Utils. Added some calculations to Utils. Added defines to global.h.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
816 {
135
e68b27ad8a40 Added dutch translations to the internal acids array. Added slot for calc_acid checkbox. Added more water calculations. The miscs amount fields now have two decimal digits. Show treated waters and good/bad indicators.
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
817 return (-2.0 * PartCO3(pH) - PartHCO3(pH));
134
5099df8ba6c6 Moved the mix function to Utils. Added some calculations to Utils. Added defines to global.h.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
818 }
5099df8ba6c6 Moved the mix function to Utils. Added some calculations to Utils. Added defines to global.h.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
819
135
e68b27ad8a40 Added dutch translations to the internal acids array. Added slot for calc_acid checkbox. Added more water calculations. The miscs amount fields now have two decimal digits. Show treated waters and good/bad indicators.
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
820
e68b27ad8a40 Added dutch translations to the internal acids array. Added slot for calc_acid checkbox. Added more water calculations. The miscs amount fields now have two decimal digits. Show treated waters and good/bad indicators.
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
821 double Utils::CalcFrac(double TpH, double pK1, double pK2, double pK3)
e68b27ad8a40 Added dutch translations to the internal acids array. Added slot for calc_acid checkbox. Added more water calculations. The miscs amount fields now have two decimal digits. Show treated waters and good/bad indicators.
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
822 {
e68b27ad8a40 Added dutch translations to the internal acids array. Added slot for calc_acid checkbox. Added more water calculations. The miscs amount fields now have two decimal digits. Show treated waters and good/bad indicators.
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
823 double r1d = pow(10.0, TpH - pK1);
e68b27ad8a40 Added dutch translations to the internal acids array. Added slot for calc_acid checkbox. Added more water calculations. The miscs amount fields now have two decimal digits. Show treated waters and good/bad indicators.
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
824 double r2d = pow(10.0, TpH - pK2);
e68b27ad8a40 Added dutch translations to the internal acids array. Added slot for calc_acid checkbox. Added more water calculations. The miscs amount fields now have two decimal digits. Show treated waters and good/bad indicators.
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
825 double r3d = pow(10.0, TpH - pK3);
e68b27ad8a40 Added dutch translations to the internal acids array. Added slot for calc_acid checkbox. Added more water calculations. The miscs amount fields now have two decimal digits. Show treated waters and good/bad indicators.
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
826 double dd = 1.0 / (1.0 + r1d + r1d * r2d + r1d * r2d * r3d);
e68b27ad8a40 Added dutch translations to the internal acids array. Added slot for calc_acid checkbox. Added more water calculations. The miscs amount fields now have two decimal digits. Show treated waters and good/bad indicators.
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
827 double f2d = r1d * dd;
e68b27ad8a40 Added dutch translations to the internal acids array. Added slot for calc_acid checkbox. Added more water calculations. The miscs amount fields now have two decimal digits. Show treated waters and good/bad indicators.
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
828 double f3d = r1d * r2d * dd;
e68b27ad8a40 Added dutch translations to the internal acids array. Added slot for calc_acid checkbox. Added more water calculations. The miscs amount fields now have two decimal digits. Show treated waters and good/bad indicators.
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
829 double f4d = r1d * r2d * r3d * dd;
e68b27ad8a40 Added dutch translations to the internal acids array. Added slot for calc_acid checkbox. Added more water calculations. The miscs amount fields now have two decimal digits. Show treated waters and good/bad indicators.
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
830 return f2d + 2.0 * f3d + 3.0 * f4d;
e68b27ad8a40 Added dutch translations to the internal acids array. Added slot for calc_acid checkbox. Added more water calculations. The miscs amount fields now have two decimal digits. Show treated waters and good/bad indicators.
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
831 }
e68b27ad8a40 Added dutch translations to the internal acids array. Added slot for calc_acid checkbox. Added more water calculations. The miscs amount fields now have two decimal digits. Show treated waters and good/bad indicators.
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
832
e68b27ad8a40 Added dutch translations to the internal acids array. Added slot for calc_acid checkbox. Added more water calculations. The miscs amount fields now have two decimal digits. Show treated waters and good/bad indicators.
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
833
212
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
834 double Utils::kettle_cm(double volume, double kettle_volume, double kettle_height)
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
835 {
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
836 if ((volume > 0) && (kettle_volume > 0) && (volume <= kettle_volume))
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
837 return round(100 * ((1 - volume / kettle_volume) * kettle_height) * 10.0) / 10.0;
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
838 return 0;
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
839 }
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
840
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
841
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
842 double Utils::kettle_vol(double cm, double kettle_volume, double kettle_height)
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
843 {
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
844 if ((cm >= 0) && (kettle_volume > 0) && (cm <= (kettle_height * 100)))
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
845 return round(((kettle_height - (cm / 100)) / kettle_height) * kettle_volume * 10.0) / 10.0;
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
846 return 0;
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
847 }
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
848
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
849
443
3c195eb4e7a1 Details CO2 monitor shows the style limits for the specific beer. Adjust the scale of the pressure widget to the beer limits. Moved more functions to the global Utils. Fix expected pressure in the package screen for other priming sugars. Disabled some debug log messages.
Michiel Broek <mbroek@mbse.eu>
parents: 442
diff changeset
850 double Utils::ResCO2(double T)
3c195eb4e7a1 Details CO2 monitor shows the style limits for the specific beer. Adjust the scale of the pressure widget to the beer limits. Moved more functions to the global Utils. Fix expected pressure in the package screen for other priming sugars. Disabled some debug log messages.
Michiel Broek <mbroek@mbse.eu>
parents: 442
diff changeset
851 {
3c195eb4e7a1 Details CO2 monitor shows the style limits for the specific beer. Adjust the scale of the pressure widget to the beer limits. Moved more functions to the global Utils. Fix expected pressure in the package screen for other priming sugars. Disabled some debug log messages.
Michiel Broek <mbroek@mbse.eu>
parents: 442
diff changeset
852 double F = T * 1.8 + 32;
3c195eb4e7a1 Details CO2 monitor shows the style limits for the specific beer. Adjust the scale of the pressure widget to the beer limits. Moved more functions to the global Utils. Fix expected pressure in the package screen for other priming sugars. Disabled some debug log messages.
Michiel Broek <mbroek@mbse.eu>
parents: 442
diff changeset
853 return round((3.0378 - 0.050062 * F + 0.00026555 * F * F) * 1000000.0) / 1000000.0;
3c195eb4e7a1 Details CO2 monitor shows the style limits for the specific beer. Adjust the scale of the pressure widget to the beer limits. Moved more functions to the global Utils. Fix expected pressure in the package screen for other priming sugars. Disabled some debug log messages.
Michiel Broek <mbroek@mbse.eu>
parents: 442
diff changeset
854 }
3c195eb4e7a1 Details CO2 monitor shows the style limits for the specific beer. Adjust the scale of the pressure widget to the beer limits. Moved more functions to the global Utils. Fix expected pressure in the package screen for other priming sugars. Disabled some debug log messages.
Michiel Broek <mbroek@mbse.eu>
parents: 442
diff changeset
855
3c195eb4e7a1 Details CO2 monitor shows the style limits for the specific beer. Adjust the scale of the pressure widget to the beer limits. Moved more functions to the global Utils. Fix expected pressure in the package screen for other priming sugars. Disabled some debug log messages.
Michiel Broek <mbroek@mbse.eu>
parents: 442
diff changeset
856
3c195eb4e7a1 Details CO2 monitor shows the style limits for the specific beer. Adjust the scale of the pressure widget to the beer limits. Moved more functions to the global Utils. Fix expected pressure in the package screen for other priming sugars. Disabled some debug log messages.
Michiel Broek <mbroek@mbse.eu>
parents: 442
diff changeset
857 double Utils::CarbCO2toS(double CO2, double T, double SFactor)
3c195eb4e7a1 Details CO2 monitor shows the style limits for the specific beer. Adjust the scale of the pressure widget to the beer limits. Moved more functions to the global Utils. Fix expected pressure in the package screen for other priming sugars. Disabled some debug log messages.
Michiel Broek <mbroek@mbse.eu>
parents: 442
diff changeset
858 {
3c195eb4e7a1 Details CO2 monitor shows the style limits for the specific beer. Adjust the scale of the pressure widget to the beer limits. Moved more functions to the global Utils. Fix expected pressure in the package screen for other priming sugars. Disabled some debug log messages.
Michiel Broek <mbroek@mbse.eu>
parents: 442
diff changeset
859 double sugar = round((SFactor * (CO2 - ResCO2(T)) * 4.014094) * 1000000.0) / 1000000.0;
3c195eb4e7a1 Details CO2 monitor shows the style limits for the specific beer. Adjust the scale of the pressure widget to the beer limits. Moved more functions to the global Utils. Fix expected pressure in the package screen for other priming sugars. Disabled some debug log messages.
Michiel Broek <mbroek@mbse.eu>
parents: 442
diff changeset
860 if (sugar < 0)
3c195eb4e7a1 Details CO2 monitor shows the style limits for the specific beer. Adjust the scale of the pressure widget to the beer limits. Moved more functions to the global Utils. Fix expected pressure in the package screen for other priming sugars. Disabled some debug log messages.
Michiel Broek <mbroek@mbse.eu>
parents: 442
diff changeset
861 sugar = 0;
3c195eb4e7a1 Details CO2 monitor shows the style limits for the specific beer. Adjust the scale of the pressure widget to the beer limits. Moved more functions to the global Utils. Fix expected pressure in the package screen for other priming sugars. Disabled some debug log messages.
Michiel Broek <mbroek@mbse.eu>
parents: 442
diff changeset
862 return sugar;
3c195eb4e7a1 Details CO2 monitor shows the style limits for the specific beer. Adjust the scale of the pressure widget to the beer limits. Moved more functions to the global Utils. Fix expected pressure in the package screen for other priming sugars. Disabled some debug log messages.
Michiel Broek <mbroek@mbse.eu>
parents: 442
diff changeset
863 }
3c195eb4e7a1 Details CO2 monitor shows the style limits for the specific beer. Adjust the scale of the pressure widget to the beer limits. Moved more functions to the global Utils. Fix expected pressure in the package screen for other priming sugars. Disabled some debug log messages.
Michiel Broek <mbroek@mbse.eu>
parents: 442
diff changeset
864
3c195eb4e7a1 Details CO2 monitor shows the style limits for the specific beer. Adjust the scale of the pressure widget to the beer limits. Moved more functions to the global Utils. Fix expected pressure in the package screen for other priming sugars. Disabled some debug log messages.
Michiel Broek <mbroek@mbse.eu>
parents: 442
diff changeset
865
442
d8c110d91b1f Moved GetPressureBar function to the Utils.
Michiel Broek <mbroek@mbse.eu>
parents: 440
diff changeset
866 double Utils::GetPressureBar(double gl, double T)
d8c110d91b1f Moved GetPressureBar function to the Utils.
Michiel Broek <mbroek@mbse.eu>
parents: 440
diff changeset
867 {
d8c110d91b1f Moved GetPressureBar function to the Utils.
Michiel Broek <mbroek@mbse.eu>
parents: 440
diff changeset
868 if (gl <= 0)
d8c110d91b1f Moved GetPressureBar function to the Utils.
Michiel Broek <mbroek@mbse.eu>
parents: 440
diff changeset
869 return 0;
d8c110d91b1f Moved GetPressureBar function to the Utils.
Michiel Broek <mbroek@mbse.eu>
parents: 440
diff changeset
870
d8c110d91b1f Moved GetPressureBar function to the Utils.
Michiel Broek <mbroek@mbse.eu>
parents: 440
diff changeset
871 double P = ((gl / 10.0) / exp(-10.73797 + (2617.25 / (T + 273.15)))) - 1.013;
d8c110d91b1f Moved GetPressureBar function to the Utils.
Michiel Broek <mbroek@mbse.eu>
parents: 440
diff changeset
872 if (P < 0)
d8c110d91b1f Moved GetPressureBar function to the Utils.
Michiel Broek <mbroek@mbse.eu>
parents: 440
diff changeset
873 P = 0;
d8c110d91b1f Moved GetPressureBar function to the Utils.
Michiel Broek <mbroek@mbse.eu>
parents: 440
diff changeset
874
d8c110d91b1f Moved GetPressureBar function to the Utils.
Michiel Broek <mbroek@mbse.eu>
parents: 440
diff changeset
875 P = round(P * 100.0) / 100.0;
444
4f626d0bb4d4 Toon ook de gewenste en verwachte hergisting druk.
Michiel Broek <mbroek@mbse.eu>
parents: 443
diff changeset
876 //qDebug() << " GetPressureBar(" << gl << "," << T << ") P:" << P;
442
d8c110d91b1f Moved GetPressureBar function to the Utils.
Michiel Broek <mbroek@mbse.eu>
parents: 440
diff changeset
877 return P;
d8c110d91b1f Moved GetPressureBar function to the Utils.
Michiel Broek <mbroek@mbse.eu>
parents: 440
diff changeset
878 }
d8c110d91b1f Moved GetPressureBar function to the Utils.
Michiel Broek <mbroek@mbse.eu>
parents: 440
diff changeset
879
498
c6f957fa7442 In fermentation plot draw the SG line with temperature compensation.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
880
c6f957fa7442 In fermentation plot draw the SG line with temperature compensation.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
881 double Utils::HydroCorrection(double mg, double tr, double tc)
c6f957fa7442 In fermentation plot draw the SG line with temperature compensation.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
882 {
c6f957fa7442 In fermentation plot draw the SG line with temperature compensation.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
883 double trf = tr * 1.8 + 32;
c6f957fa7442 In fermentation plot draw the SG line with temperature compensation.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
884 double tcf = tc * 1.8 + 32;
c6f957fa7442 In fermentation plot draw the SG line with temperature compensation.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
885
c6f957fa7442 In fermentation plot draw the SG line with temperature compensation.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
886 return mg * ((1.00130346 - 1.34722124E-4 * trf + 2.04052596E-6 * trf * trf - 2.32820948E-9 * trf * trf * trf) /
c6f957fa7442 In fermentation plot draw the SG line with temperature compensation.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
887 (1.00130346 - 1.34722124E-4 * tcf + 2.04052596E-6 * tcf * tcf - 2.32820948E-9 * tcf * tcf * tcf));
c6f957fa7442 In fermentation plot draw the SG line with temperature compensation.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
888 }
c6f957fa7442 In fermentation plot draw the SG line with temperature compensation.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
889
c6f957fa7442 In fermentation plot draw the SG line with temperature compensation.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
890

mercurial