Fri, 08 Jul 2022 13:24:45 +0200
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.
129
a9c19eaab018
Blocked hop table edit. Implemented add and delete hop rows. Started the ui of the water tab.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1 | /** |
a9c19eaab018
Blocked hop table edit. Implemented add and delete hop rows. Started the ui of the water tab.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
2 | * EditRecipe.cpp is part of bmsapp. |
a9c19eaab018
Blocked hop table edit. Implemented add and delete hop rows. Started the ui of the water tab.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
3 | * |
a9c19eaab018
Blocked hop table edit. Implemented add and delete hop rows. Started the ui of the water tab.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
4 | * tab 6, water. |
a9c19eaab018
Blocked hop table edit. Implemented add and delete hop rows. Started the ui of the water tab.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
5 | * |
a9c19eaab018
Blocked hop table edit. Implemented add and delete hop rows. Started the ui of the water tab.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
6 | * bmsapp is free software: you can redistribute it and/or modify |
a9c19eaab018
Blocked hop table edit. Implemented add and delete hop rows. Started the ui of the water tab.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
7 | * it under the terms of the GNU General Public License as published by |
a9c19eaab018
Blocked hop table edit. Implemented add and delete hop rows. Started the ui of the water tab.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
8 | * the Free Software Foundation, either version 3 of the License, or |
a9c19eaab018
Blocked hop table edit. Implemented add and delete hop rows. Started the ui of the water tab.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
9 | * (at your option) any later version. |
a9c19eaab018
Blocked hop table edit. Implemented add and delete hop rows. Started the ui of the water tab.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
10 | * |
a9c19eaab018
Blocked hop table edit. Implemented add and delete hop rows. Started the ui of the water tab.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
11 | * bmsapp is distributed in the hope that it will be useful, |
a9c19eaab018
Blocked hop table edit. Implemented add and delete hop rows. Started the ui of the water tab.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
a9c19eaab018
Blocked hop table edit. Implemented add and delete hop rows. Started the ui of the water tab.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
a9c19eaab018
Blocked hop table edit. Implemented add and delete hop rows. Started the ui of the water tab.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
14 | * GNU General Public License for more details. |
a9c19eaab018
Blocked hop table edit. Implemented add and delete hop rows. Started the ui of the water tab.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
15 | * |
a9c19eaab018
Blocked hop table edit. Implemented add and delete hop rows. Started the ui of the water tab.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
16 | * You should have received a copy of the GNU General Public License |
a9c19eaab018
Blocked hop table edit. Implemented add and delete hop rows. Started the ui of the water tab.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
a9c19eaab018
Blocked hop table edit. Implemented add and delete hop rows. Started the ui of the water tab.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
18 | */ |
a9c19eaab018
Blocked hop table edit. Implemented add and delete hop rows. Started the ui of the water tab.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
19 | |
a9c19eaab018
Blocked hop table edit. Implemented add and delete hop rows. Started the ui of the water tab.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
20 | |
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:
129
diff
changeset
|
21 | void EditRecipe::refreshWaters() |
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:
129
diff
changeset
|
22 | { |
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:
129
diff
changeset
|
23 | |
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:
129
diff
changeset
|
24 | // calc_acid |
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:
129
diff
changeset
|
25 | ui->mw_phEdit->setValue(recipe->mash_ph); |
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:
129
diff
changeset
|
26 | // mash_name |
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:
129
diff
changeset
|
27 | //ui->mw_acidpercEdit->setValue(recipe-> |
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:
129
diff
changeset
|
28 | |
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:
129
diff
changeset
|
29 | } |
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:
129
diff
changeset
|
30 | |
133
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
31 | |
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
|
32 | /* |
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
|
33 | * Z alkalinity is the amount of acid (in mEq/l) needed to bring water to the target pH (Z 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
|
34 | */ |
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
|
35 | double EditRecipe::ZAlkalinity(double pHZ) |
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
|
36 | { |
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
|
37 | double C43 = Utils::Charge(4.3); |
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
|
38 | double Cw = Utils::Charge(recipe->wg_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
|
39 | double Cz = Utils::Charge(pHZ); |
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
|
40 | double DeltaCNaught = -C43 + Cw; |
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
|
41 | double CT = recipe->wg_total_alkalinity / 50 / DeltaCNaught; |
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
|
42 | double DeltaCZ = -Cz + Cw; |
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
|
43 | return CT * DeltaCZ; |
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
|
44 | } |
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
|
45 | |
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
|
46 | |
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
|
47 | /* |
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
|
48 | * Z Residual alkalinity is the amount of acid (in mEq/l) needed |
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
|
49 | * to bring the water in the mash to the target pH (Z 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
|
50 | */ |
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
|
51 | double EditRecipe::ZRA(double pHZ) |
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
|
52 | { |
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
|
53 | double Calc = recipe->wg_calcium / (MMCa / 2); |
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
|
54 | double Magn = recipe->wg_magnesium / (MMMg / 2); |
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
|
55 | double Z = ZAlkalinity(pHZ); |
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
|
56 | return Z - (Calc / 3.5 + Magn / 7); |
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
|
57 | } |
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
|
58 | |
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
|
59 | |
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
|
60 | double EditRecipe::BufferCapacity(Fermentables F) |
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
|
61 | { |
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
|
62 | double C1 = 0; |
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
|
63 | |
283
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
162
diff
changeset
|
64 | if ((F.di_ph != 5.7) && ((F.acid_to_ph_57 < - 0.1) || (F.acid_to_ph_57 > 0.1))) { |
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
162
diff
changeset
|
65 | C1 = F.acid_to_ph_57 / (F.di_ph - 5.7); |
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
|
66 | } else { |
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
|
67 | /* |
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
|
68 | * If the acid_to_ph_5.7 is unknown from the maltster, guess the required acid. |
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
|
69 | */ |
283
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
162
diff
changeset
|
70 | switch (F.graintype) { |
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
|
71 | case 0: // Base, Special, Kilned |
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
|
72 | case 3: |
283
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
162
diff
changeset
|
73 | case 5: C1 = 0.014 * F.color - 34.192; |
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
|
74 | break; |
283
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
162
diff
changeset
|
75 | case 2: C1 = -0.0597 * F.color - 32.457; // Crystal |
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
|
76 | break; |
283
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
162
diff
changeset
|
77 | case 1: C1 = 0.0107 * F.color - 54.768; // Roast |
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
|
78 | break; |
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
|
79 | case 4: C1 = -149; // Sour malt |
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
|
80 | break; |
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
|
81 | } |
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
|
82 | } |
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
|
83 | return C1; |
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
|
84 | } |
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
|
85 | |
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
|
86 | |
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
|
87 | double EditRecipe::AcidRequired(double ZpH, Fermentables F) |
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
|
88 | { |
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
|
89 | double C1 = BufferCapacity(F); |
283
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
162
diff
changeset
|
90 | double x = F.di_ph; |
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
|
91 | return C1 * (ZpH - x); |
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
|
92 | } |
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
|
93 | |
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
|
94 | |
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
|
95 | double EditRecipe::ProtonDeficit(double pHZ) |
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
|
96 | { |
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
|
97 | double C1, x; |
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
|
98 | int i, error_count = 0; |
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
|
99 | double Result = ZRA(pHZ) * recipe->wg_amount; |
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
|
100 | Fermentables F; |
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
|
101 | |
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
|
102 | /* |
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
|
103 | * proton deficit for the grist |
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
|
104 | */ |
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
|
105 | if (recipe->fermentables.size()) { |
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
|
106 | for (i = 0; i < recipe->fermentables.size(); i++) { |
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
|
107 | F = recipe->fermentables.at(i); |
283
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
162
diff
changeset
|
108 | if (F.added == 0 && F.graintype != 6) { // Added == Mash && graintype != No Malt |
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
162
diff
changeset
|
109 | x = AcidRequired(pHZ, F) * F.amount; |
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
|
110 | Result += x; |
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
|
111 | } |
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
|
112 | } |
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
|
113 | } else { |
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
|
114 | error_count++; |
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
|
115 | if (error_count < 5) |
136
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
116 | qDebug() << " ProtonDeficit" << pHZ << "invalid grist, return" << Result; |
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
|
117 | } |
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
|
118 | return Result; |
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
|
119 | } |
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
|
120 | |
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
|
121 | |
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
|
122 | double EditRecipe::MashpH() |
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
|
123 | { |
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
|
124 | int n = 0; |
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
|
125 | double pH = 5.4; |
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
|
126 | double deltapH = 0.001; |
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
|
127 | double deltapd = 0.1; |
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
|
128 | double pd = ProtonDeficit(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
|
129 | |
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
|
130 | while (((pd < -deltapd) || (pd > deltapd)) && (n < 2000)) { |
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
|
131 | n++; |
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
|
132 | if (pd < -deltapd) |
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
|
133 | pH -= deltapH; |
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
|
134 | else if (pd > deltapd) |
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
|
135 | pH += deltapH; |
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
|
136 | pd = ProtonDeficit(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
|
137 | } |
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
|
138 | pH = round(pH * 1000000) / 1000000.0; |
136
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
139 | qDebug() << " MashpH() n:" << n << "pH:" << pH; |
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
|
140 | return 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
|
141 | } |
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
|
142 | |
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
|
143 | |
133
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
144 | void EditRecipe::calcWater() |
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
145 | { |
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
146 | double liters = 0; |
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
147 | double calcium = 0; |
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
148 | double magnesium = 0; |
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
149 | double sodium = 0; |
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
150 | double total_alkalinity = 0; |
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
151 | double bicarbonate = 0; |
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
152 | double chloride = 0; |
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
153 | double sulfate = 0; |
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
154 | double ph = 0; |
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
|
155 | double TpH = 0; |
136
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
156 | double frac, RA; |
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
|
157 | double protonDeficit = 0; |
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
|
158 | double Acid = 0, Acidmg = 0; |
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
|
159 | int AT; |
133
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
160 | |
136
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
161 | qDebug() << "calcWater()"; |
133
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
162 | |
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
163 | /* |
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
164 | * If there is a dilute water source, mix the waters. |
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
165 | */ |
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
166 | if (recipe->w2_name != "") { |
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
167 | liters = recipe->w1_amount + recipe->w2_amount; |
134
5099df8ba6c6
Moved the mix function to Utils. Added some calculations to Utils. Added defines to global.h.
Michiel Broek <mbroek@mbse.eu>
parents:
133
diff
changeset
|
168 | calcium = Utils::mix(recipe->w1_amount, recipe->w2_amount, recipe->w1_calcium, recipe->w2_calcium); |
5099df8ba6c6
Moved the mix function to Utils. Added some calculations to Utils. Added defines to global.h.
Michiel Broek <mbroek@mbse.eu>
parents:
133
diff
changeset
|
169 | magnesium = Utils::mix(recipe->w1_amount, recipe->w2_amount, recipe->w1_magnesium, recipe->w2_magnesium); |
5099df8ba6c6
Moved the mix function to Utils. Added some calculations to Utils. Added defines to global.h.
Michiel Broek <mbroek@mbse.eu>
parents:
133
diff
changeset
|
170 | sodium = Utils::mix(recipe->w1_amount, recipe->w2_amount, recipe->w1_sodium, recipe->w2_sodium); |
5099df8ba6c6
Moved the mix function to Utils. Added some calculations to Utils. Added defines to global.h.
Michiel Broek <mbroek@mbse.eu>
parents:
133
diff
changeset
|
171 | chloride = Utils::mix(recipe->w1_amount, recipe->w2_amount, recipe->w1_chloride, recipe->w2_chloride); |
5099df8ba6c6
Moved the mix function to Utils. Added some calculations to Utils. Added defines to global.h.
Michiel Broek <mbroek@mbse.eu>
parents:
133
diff
changeset
|
172 | sulfate = Utils::mix(recipe->w1_amount, recipe->w2_amount, recipe->w1_sulfate, recipe->w2_sulfate); |
5099df8ba6c6
Moved the mix function to Utils. Added some calculations to Utils. Added defines to global.h.
Michiel Broek <mbroek@mbse.eu>
parents:
133
diff
changeset
|
173 | total_alkalinity = Utils::mix(recipe->w1_amount, recipe->w2_amount, recipe->w1_total_alkalinity, recipe->w2_total_alkalinity); |
133
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
174 | ph = -log10(((pow(10, -recipe->w1_ph) * recipe->w1_amount) + (pow(10, -recipe->w2_ph) * recipe->w2_amount)) / liters); |
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
175 | } else { |
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
176 | liters = recipe->w1_amount; |
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
177 | calcium = recipe->w1_calcium; |
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
178 | magnesium = recipe->w1_magnesium; |
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
179 | sodium = recipe->w1_sodium; |
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
180 | chloride = recipe->w1_chloride; |
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
181 | sulfate = recipe->w1_sulfate; |
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
182 | total_alkalinity = recipe->w1_total_alkalinity; |
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
183 | ph = recipe->w1_ph; |
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
184 | } |
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
185 | |
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
186 | recipe->wg_amount = liters; |
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
187 | recipe->wg_calcium = round(calcium * 10.0) / 10.0; |
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
188 | recipe->wg_magnesium = round(magnesium * 10.0) / 10.0; |
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
189 | recipe->wg_sodium = round(sodium * 10.0) / 10.0; |
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
190 | recipe->wg_chloride = round(chloride * 10.0) / 10.0; |
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
191 | recipe->wg_sulfate = round(sulfate * 10.0) / 10.0; |
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
192 | recipe->wg_total_alkalinity = round(total_alkalinity * 10.0) / 10.0; |
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
|
193 | recipe->wg_ph = ph; |
133
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
194 | |
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
195 | ui->wg_volEdit->setValue(liters); |
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
196 | ui->wg_caEdit->setValue(calcium); |
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
197 | ui->wg_mgEdit->setValue(magnesium); |
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
198 | ui->wg_hco3Edit->setValue(total_alkalinity * 1.22); |
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
199 | ui->wg_caco3Edit->setValue(total_alkalinity); |
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
200 | ui->wg_naEdit->setValue(sodium); |
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
201 | ui->wg_clEdit->setValue(chloride); |
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
202 | ui->wg_so4Edit->setValue(sulfate); |
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
203 | ui->wg_phEdit->setValue(ph); |
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
204 | bicarbonate = total_alkalinity * 1.22; |
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
205 | |
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
206 | /* Save mixed water ions for later */ |
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
207 | double wg_calcium = calcium; |
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
208 | double wg_sodium = sodium; |
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
209 | double wg_total_alkalinity = total_alkalinity; |
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
210 | double wg_chloride = chloride; |
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
211 | double wg_sulfate = sulfate; |
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
212 | double wg_bicarbonate = bicarbonate; |
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
213 | |
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
|
214 | double mash_ph = MashpH(); |
136
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
215 | qDebug() << " Distilled water mash pH:" << mash_ph; |
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
|
216 | |
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
|
217 | /* Calculate Salt additions */ |
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
|
218 | if (liters > 0) { |
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
|
219 | calcium += ( ui->bs_cacl2Edit->value() * MMCa / MMCaCl2 * 1000 + ui->bs_caso4Edit->value() * MMCa / MMCaSO4 * 1000 + |
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
|
220 | ui->bs_caco3Edit->value() * MMCa / MMCaCO3 * 1000) / liters; |
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
|
221 | magnesium += (ui->bs_mgso4Edit->value() * MMMg / MMMgSO4 * 1000 + ui->bs_mgcl2Edit->value() * MMMg / MMMgCl2 * 1000) / liters; |
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
|
222 | sodium += (ui->bs_naclEdit->value() * MMNa / MMNaCl * 1000 + ui->bs_nahco3Edit->value() * MMNa / MMNaHCO3 * 1000) / liters; |
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
|
223 | sulfate += (ui->bs_caso4Edit->value() * MMSO4 / MMCaSO4 * 1000 + ui->bs_mgso4Edit->value() * MMSO4 / MMMgSO4 * 1000) / liters; |
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
|
224 | chloride += (2 * ui->bs_cacl2Edit->value() * MMCl / MMCaCl2 * 1000 + ui->bs_naclEdit->value() * MMCl / MMNaCl * 1000 + |
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
|
225 | ui->bs_mgcl2Edit->value() * MMCl / MMMgCl2 * 1000) / liters; |
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
|
226 | bicarbonate += (ui->bs_nahco3Edit->value() * MMHCO3 / MMNaHCO3 * 1000 + ui->bs_caco3Edit->value() / 3 * MMHCO3 / MMCaCO3 * 1000) / liters; |
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
|
227 | } |
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
|
228 | |
152
58e4ce7dd217
Fixed vanishing mash profiles from some recipes. All ingnoreChanges flags removed and replaced by blocking signals. Update prompts and yeast amounts depending on the yeast form. Save water profile names fixed.
Michiel Broek <mbroek@mbse.eu>
parents:
150
diff
changeset
|
229 | const QSignalBlocker blocker1(ui->mw_acidPick); |
58e4ce7dd217
Fixed vanishing mash profiles from some recipes. All ingnoreChanges flags removed and replaced by blocking signals. Update prompts and yeast amounts depending on the yeast form. Save water profile names fixed.
Michiel Broek <mbroek@mbse.eu>
parents:
150
diff
changeset
|
230 | const QSignalBlocker blocker2(ui->mw_acidpercEdit); |
58e4ce7dd217
Fixed vanishing mash profiles from some recipes. All ingnoreChanges flags removed and replaced by blocking signals. Update prompts and yeast amounts depending on the yeast form. Save water profile names fixed.
Michiel Broek <mbroek@mbse.eu>
parents:
150
diff
changeset
|
231 | const QSignalBlocker blocker3(ui->mw_acidvolEdit); |
58e4ce7dd217
Fixed vanishing mash profiles from some recipes. All ingnoreChanges flags removed and replaced by blocking signals. Update prompts and yeast amounts depending on the yeast form. Save water profile names fixed.
Michiel Broek <mbroek@mbse.eu>
parents:
150
diff
changeset
|
232 | const QSignalBlocker blocker4(ui->wb_phEdit); |
58e4ce7dd217
Fixed vanishing mash profiles from some recipes. All ingnoreChanges flags removed and replaced by blocking signals. Update prompts and yeast amounts depending on the yeast form. Save water profile names fixed.
Michiel Broek <mbroek@mbse.eu>
parents:
150
diff
changeset
|
233 | const QSignalBlocker blocker5(ui->mw_phEdit); |
58e4ce7dd217
Fixed vanishing mash profiles from some recipes. All ingnoreChanges flags removed and replaced by blocking signals. Update prompts and yeast amounts depending on the yeast form. Save water profile names fixed.
Michiel Broek <mbroek@mbse.eu>
parents:
150
diff
changeset
|
234 | |
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
|
235 | if (recipe->wa_acid_name < 0 || recipe->wa_acid_name >= my_acids.size()) { |
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
|
236 | recipe->wa_acid_name = 0; |
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
|
237 | recipe->wa_acid_perc = my_acids.at(0).AcidPrc; |
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
|
238 | ui->mw_acidPick->setCurrentIndex(0); |
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
|
239 | ui->mw_acidpercEdit->setValue(my_acids.at(0).AcidPrc); |
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
|
240 | } |
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
|
241 | AT = recipe->wa_acid_name; |
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
|
242 | |
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
|
243 | /* |
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
|
244 | * Note that the next calculations do not correct the pH change by the added salts. |
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
|
245 | * This pH change is at most 0.1 pH and is a minor difference in Acid amount. |
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
|
246 | */ |
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
|
247 | if (recipe->calc_acid) { |
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
|
248 | /* |
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
|
249 | * Auto calculate the needed acid. |
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
|
250 | */ |
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
|
251 | TpH = recipe->mash_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
|
252 | protonDeficit = ProtonDeficit(TpH); |
136
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
253 | qDebug() << " calc_acid tgt:" << TpH << "protonDeficit:" << protonDeficit; |
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
|
254 | if (protonDeficit > 0) { |
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
|
255 | frac = Utils::CalcFrac(TpH, my_acids[AT].pK1, my_acids[AT].pK2, my_acids[AT].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
|
256 | Acid = protonDeficit / frac; |
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
|
257 | Acid *= my_acids[AT].MolWt; // mg. |
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
|
258 | Acidmg = Acid; |
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
|
259 | Acid = Acid / my_acids[AT].AcidSG; |
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
|
260 | Acid = round((Acid / (recipe->wa_acid_perc / 100.0)) * 100.0) / 100.0; |
136
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
261 | qDebug() << " Mash auto Acid final ml:" << Acid; |
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
|
262 | |
136
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
263 | QString w = my_acids[AT].name_en + ' ' + my_acids[AT].name_nl; |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
264 | brewing_salt_sub(w, Acid); |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
265 | ui->mw_acidvolEdit->setValue(Acid); |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
266 | |
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
|
267 | bicarbonate = bicarbonate - protonDeficit * frac / liters; |
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
|
268 | total_alkalinity = bicarbonate * 50 / 61; |
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
|
269 | } |
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
|
270 | ph = TpH; |
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
|
271 | ui->wb_phEdit->setValue(ph); |
136
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
272 | recipe->mash_ph = ph; |
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
|
273 | } else { // Manual |
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
|
274 | /* |
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
|
275 | * Manual adjust acid, calculate resulting 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
|
276 | */ |
136
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
277 | double pHa = ph; // Mixed water pH. |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
278 | // Then calculate the new pH with added acids and malts |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
279 | qDebug() << " Mash pH:" << pHa; |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
280 | Acid = my_acids[AT].AcidSG * (recipe->wa_acid_perc / 100.0); // ml |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
281 | Acid *= ui->mw_acidvolEdit->value(); |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
282 | Acid /= my_acids[AT].MolWt; // mg; |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
283 | Acidmg = Acid; |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
284 | |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
285 | //find the pH where the protondeficit = protondeficit by the acid |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
286 | frac = Utils::CalcFrac(pHa, my_acids[AT].pK1, my_acids[AT].pK2, my_acids[AT].pK3); |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
287 | protonDeficit = Acid * frac; |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
288 | //qDebug() << " protonDeficit Acid:" << protonDeficit << "frac:" << frac << "pH:" << pHa; |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
289 | |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
290 | double deltapH = 0.001; |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
291 | double deltapd = 0.1; |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
292 | double pd = round(ProtonDeficit(pHa) * 1000000.0) / 1000000.0; |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
293 | int n = 0; |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
294 | while (((pd < (protonDeficit - deltapd)) || (pd > (protonDeficit + deltapd))) && (n < 4000)) { |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
295 | n++; |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
296 | if (pd < (protonDeficit - deltapd)) |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
297 | pHa -= deltapH; |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
298 | else if (pd > (protonDeficit + deltapd)) |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
299 | pHa += deltapH; |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
300 | frac = Utils::CalcFrac(pHa, my_acids[AT].pK1, my_acids[AT].pK2, my_acids[AT].pK3); |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
301 | protonDeficit = Acid * frac; |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
302 | pd = ProtonDeficit(pHa); |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
303 | } |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
304 | //qDebug() << " n:" << n << "pd:" << pd << "protonDeficit:" << protonDeficit << "frac:" << frac << "pHa:" << pHa; |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
305 | |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
306 | bicarbonate = wg_bicarbonate - protonDeficit * frac / liters; |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
307 | total_alkalinity = bicarbonate * 50 / 61; |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
308 | ph = pHa; |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
309 | ui->wb_phEdit->setValue(ph); |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
310 | ui->mw_phEdit->setValue(ph); |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
311 | recipe->mash_ph = ph; |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
312 | } |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
313 | |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
314 | if ((AT == 3) && (liters > 0)) { // Sulfuctic / Zwavelzuur |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
315 | RA = ui->bs_caso4Edit->value() * MMSO4 / MMCaSO4 + ui->bs_mgso4Edit->value() * MMSO4 / MMMgSO4 + Acidmg / 1000 * MMSO4 / (MMSO4 + 2); |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
316 | RA = 1000 * RA / liters; |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
317 | sulfate = wg_sulfate + RA; // Not add to sulfate?? |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
318 | } else if ((AT == 1) && (liters > 0)) { // Hydrochloric, Zoutzuur |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
319 | RA = ui->bs_cacl2Edit->value() * MMCl / MMCaCl2 + ui->bs_naclEdit->value() * MMCl / MMNaCl + Acidmg / 1000 * MMCl / (MMCl + 1); |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
320 | RA = 1000 * RA / liters; |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
321 | chloride = wg_chloride + RA; |
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
|
322 | } |
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
|
323 | |
137
ffe8b2e9517b
Added indicators for BUGU and SO4:Cl ratio. Force rounded values for changing brewing salts.
Michiel Broek <mbroek@mbse.eu>
parents:
136
diff
changeset
|
324 | double BUGU = GetBUGU(); |
ffe8b2e9517b
Added indicators for BUGU and SO4:Cl ratio. Force rounded values for changing brewing salts.
Michiel Broek <mbroek@mbse.eu>
parents:
136
diff
changeset
|
325 | ui->buguEdit->setValue(BUGU); |
ffe8b2e9517b
Added indicators for BUGU and SO4:Cl ratio. Force rounded values for changing brewing salts.
Michiel Broek <mbroek@mbse.eu>
parents:
136
diff
changeset
|
326 | if (BUGU < 0.32) |
ffe8b2e9517b
Added indicators for BUGU and SO4:Cl ratio. Force rounded values for changing brewing salts.
Michiel Broek <mbroek@mbse.eu>
parents:
136
diff
changeset
|
327 | ui->buguResult->setText(tr("Very malty and sweet")); |
ffe8b2e9517b
Added indicators for BUGU and SO4:Cl ratio. Force rounded values for changing brewing salts.
Michiel Broek <mbroek@mbse.eu>
parents:
136
diff
changeset
|
328 | else if (BUGU < 0.43) |
ffe8b2e9517b
Added indicators for BUGU and SO4:Cl ratio. Force rounded values for changing brewing salts.
Michiel Broek <mbroek@mbse.eu>
parents:
136
diff
changeset
|
329 | ui->buguResult->setText(tr("Malty, sweet")); |
ffe8b2e9517b
Added indicators for BUGU and SO4:Cl ratio. Force rounded values for changing brewing salts.
Michiel Broek <mbroek@mbse.eu>
parents:
136
diff
changeset
|
330 | else if (BUGU < 0.52) |
ffe8b2e9517b
Added indicators for BUGU and SO4:Cl ratio. Force rounded values for changing brewing salts.
Michiel Broek <mbroek@mbse.eu>
parents:
136
diff
changeset
|
331 | ui->buguResult->setText(tr("Balanced")); |
ffe8b2e9517b
Added indicators for BUGU and SO4:Cl ratio. Force rounded values for changing brewing salts.
Michiel Broek <mbroek@mbse.eu>
parents:
136
diff
changeset
|
332 | else if (BUGU < 0.63) |
ffe8b2e9517b
Added indicators for BUGU and SO4:Cl ratio. Force rounded values for changing brewing salts.
Michiel Broek <mbroek@mbse.eu>
parents:
136
diff
changeset
|
333 | ui->buguResult->setText(tr("Hoppy, bitter")); |
ffe8b2e9517b
Added indicators for BUGU and SO4:Cl ratio. Force rounded values for changing brewing salts.
Michiel Broek <mbroek@mbse.eu>
parents:
136
diff
changeset
|
334 | else |
ffe8b2e9517b
Added indicators for BUGU and SO4:Cl ratio. Force rounded values for changing brewing salts.
Michiel Broek <mbroek@mbse.eu>
parents:
136
diff
changeset
|
335 | ui->buguResult->setText(tr("Very hoppy, very bitter")); |
ffe8b2e9517b
Added indicators for BUGU and SO4:Cl ratio. Force rounded values for changing brewing salts.
Michiel Broek <mbroek@mbse.eu>
parents:
136
diff
changeset
|
336 | |
ffe8b2e9517b
Added indicators for BUGU and SO4:Cl ratio. Force rounded values for changing brewing salts.
Michiel Broek <mbroek@mbse.eu>
parents:
136
diff
changeset
|
337 | double OptSO4Clratio = GetOptSO4Clratio(); |
ffe8b2e9517b
Added indicators for BUGU and SO4:Cl ratio. Force rounded values for changing brewing salts.
Michiel Broek <mbroek@mbse.eu>
parents:
136
diff
changeset
|
338 | ui->so4clEdit->setValue(OptSO4Clratio); |
ffe8b2e9517b
Added indicators for BUGU and SO4:Cl ratio. Force rounded values for changing brewing salts.
Michiel Broek <mbroek@mbse.eu>
parents:
136
diff
changeset
|
339 | ui->cur_so4clResult->setRange(0.7 * OptSO4Clratio, 1.3 * OptSO4Clratio); |
ffe8b2e9517b
Added indicators for BUGU and SO4:Cl ratio. Force rounded values for changing brewing salts.
Michiel Broek <mbroek@mbse.eu>
parents:
136
diff
changeset
|
340 | if (OptSO4Clratio < 0.4) |
ffe8b2e9517b
Added indicators for BUGU and SO4:Cl ratio. Force rounded values for changing brewing salts.
Michiel Broek <mbroek@mbse.eu>
parents:
136
diff
changeset
|
341 | ui->so4clResult->setText(tr("Too malty")); |
ffe8b2e9517b
Added indicators for BUGU and SO4:Cl ratio. Force rounded values for changing brewing salts.
Michiel Broek <mbroek@mbse.eu>
parents:
136
diff
changeset
|
342 | else if (OptSO4Clratio < 0.6) |
ffe8b2e9517b
Added indicators for BUGU and SO4:Cl ratio. Force rounded values for changing brewing salts.
Michiel Broek <mbroek@mbse.eu>
parents:
136
diff
changeset
|
343 | ui->so4clResult->setText(tr("Very malty")); |
ffe8b2e9517b
Added indicators for BUGU and SO4:Cl ratio. Force rounded values for changing brewing salts.
Michiel Broek <mbroek@mbse.eu>
parents:
136
diff
changeset
|
344 | else if (OptSO4Clratio < 0.8) |
ffe8b2e9517b
Added indicators for BUGU and SO4:Cl ratio. Force rounded values for changing brewing salts.
Michiel Broek <mbroek@mbse.eu>
parents:
136
diff
changeset
|
345 | ui->so4clResult->setText(tr("Malty")); |
ffe8b2e9517b
Added indicators for BUGU and SO4:Cl ratio. Force rounded values for changing brewing salts.
Michiel Broek <mbroek@mbse.eu>
parents:
136
diff
changeset
|
346 | else if (OptSO4Clratio < 1.5) |
ffe8b2e9517b
Added indicators for BUGU and SO4:Cl ratio. Force rounded values for changing brewing salts.
Michiel Broek <mbroek@mbse.eu>
parents:
136
diff
changeset
|
347 | ui->so4clResult->setText(tr("Balanced")); |
ffe8b2e9517b
Added indicators for BUGU and SO4:Cl ratio. Force rounded values for changing brewing salts.
Michiel Broek <mbroek@mbse.eu>
parents:
136
diff
changeset
|
348 | else if (OptSO4Clratio < 2.0) |
ffe8b2e9517b
Added indicators for BUGU and SO4:Cl ratio. Force rounded values for changing brewing salts.
Michiel Broek <mbroek@mbse.eu>
parents:
136
diff
changeset
|
349 | ui->so4clResult->setText(tr("Little bitter")); |
ffe8b2e9517b
Added indicators for BUGU and SO4:Cl ratio. Force rounded values for changing brewing salts.
Michiel Broek <mbroek@mbse.eu>
parents:
136
diff
changeset
|
350 | else if (OptSO4Clratio < 4.0) |
ffe8b2e9517b
Added indicators for BUGU and SO4:Cl ratio. Force rounded values for changing brewing salts.
Michiel Broek <mbroek@mbse.eu>
parents:
136
diff
changeset
|
351 | ui->so4clResult->setText(tr("Bitter")); |
ffe8b2e9517b
Added indicators for BUGU and SO4:Cl ratio. Force rounded values for changing brewing salts.
Michiel Broek <mbroek@mbse.eu>
parents:
136
diff
changeset
|
352 | else if (OptSO4Clratio < 9.0) |
ffe8b2e9517b
Added indicators for BUGU and SO4:Cl ratio. Force rounded values for changing brewing salts.
Michiel Broek <mbroek@mbse.eu>
parents:
136
diff
changeset
|
353 | ui->so4clResult->setText(tr("Very bitter")); |
ffe8b2e9517b
Added indicators for BUGU and SO4:Cl ratio. Force rounded values for changing brewing salts.
Michiel Broek <mbroek@mbse.eu>
parents:
136
diff
changeset
|
354 | else |
ffe8b2e9517b
Added indicators for BUGU and SO4:Cl ratio. Force rounded values for changing brewing salts.
Michiel Broek <mbroek@mbse.eu>
parents:
136
diff
changeset
|
355 | ui->so4clResult->setText(tr("Too bitter")); |
ffe8b2e9517b
Added indicators for BUGU and SO4:Cl ratio. Force rounded values for changing brewing salts.
Michiel Broek <mbroek@mbse.eu>
parents:
136
diff
changeset
|
356 | if (chloride > 0) |
ffe8b2e9517b
Added indicators for BUGU and SO4:Cl ratio. Force rounded values for changing brewing salts.
Michiel Broek <mbroek@mbse.eu>
parents:
136
diff
changeset
|
357 | RA = sulfate / chloride; |
ffe8b2e9517b
Added indicators for BUGU and SO4:Cl ratio. Force rounded values for changing brewing salts.
Michiel Broek <mbroek@mbse.eu>
parents:
136
diff
changeset
|
358 | else |
ffe8b2e9517b
Added indicators for BUGU and SO4:Cl ratio. Force rounded values for changing brewing salts.
Michiel Broek <mbroek@mbse.eu>
parents:
136
diff
changeset
|
359 | RA = 10; |
ffe8b2e9517b
Added indicators for BUGU and SO4:Cl ratio. Force rounded values for changing brewing salts.
Michiel Broek <mbroek@mbse.eu>
parents:
136
diff
changeset
|
360 | ui->cur_so4clEdit->setValue(RA); |
ffe8b2e9517b
Added indicators for BUGU and SO4:Cl ratio. Force rounded values for changing brewing salts.
Michiel Broek <mbroek@mbse.eu>
parents:
136
diff
changeset
|
361 | ui->cur_so4clResult->setValue(RA); |
ffe8b2e9517b
Added indicators for BUGU and SO4:Cl ratio. Force rounded values for changing brewing salts.
Michiel Broek <mbroek@mbse.eu>
parents:
136
diff
changeset
|
362 | |
161
b36d249512cc
Fix missing values for treated water.
Michiel Broek <mbroek@mbse.eu>
parents:
152
diff
changeset
|
363 | recipe->wb_calcium = calcium; |
b36d249512cc
Fix missing values for treated water.
Michiel Broek <mbroek@mbse.eu>
parents:
152
diff
changeset
|
364 | recipe->wb_magnesium = magnesium; |
b36d249512cc
Fix missing values for treated water.
Michiel Broek <mbroek@mbse.eu>
parents:
152
diff
changeset
|
365 | recipe->wb_total_alkalinity = total_alkalinity; |
b36d249512cc
Fix missing values for treated water.
Michiel Broek <mbroek@mbse.eu>
parents:
152
diff
changeset
|
366 | recipe->wb_sodium = sodium; |
b36d249512cc
Fix missing values for treated water.
Michiel Broek <mbroek@mbse.eu>
parents:
152
diff
changeset
|
367 | recipe->wb_chloride = chloride; |
b36d249512cc
Fix missing values for treated water.
Michiel Broek <mbroek@mbse.eu>
parents:
152
diff
changeset
|
368 | recipe->wb_sulfate = sulfate; |
b36d249512cc
Fix missing values for treated water.
Michiel Broek <mbroek@mbse.eu>
parents:
152
diff
changeset
|
369 | recipe->wb_ph = ph; |
b36d249512cc
Fix missing values for treated water.
Michiel Broek <mbroek@mbse.eu>
parents:
152
diff
changeset
|
370 | |
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
|
371 | ui->wb_caEdit->setValue(calcium); |
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
|
372 | ui->wb_mgEdit->setValue(magnesium); |
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
|
373 | ui->wb_hco3Edit->setValue(bicarbonate); |
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
|
374 | ui->wb_caco3Edit->setValue(total_alkalinity); |
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
|
375 | ui->wb_naEdit->setValue(sodium); |
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
|
376 | ui->wb_clEdit->setValue(chloride); |
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
|
377 | ui->wb_so4Edit->setValue(sulfate); |
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
|
378 | |
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
|
379 | ui->wb_caEdit->setStyleSheet((calcium < 40 || calcium > 150) ? "background-color: red":"background-color: green"); |
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
|
380 | ui->wb_mgEdit->setStyleSheet((magnesium < 5 || magnesium > 40) ? "background-color: red":"background-color: green"); |
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
|
381 | ui->wb_naEdit->setStyleSheet((sodium > 150) ? "background-color: red":"background-color: green"); |
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
|
382 | /* |
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
|
383 | * Both chloride and sulfate should be above 50 according to |
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
|
384 | * John Palmer. So the Cl/SO4 ratio calculation will work. |
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
|
385 | */ |
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
|
386 | ui->wb_clEdit->setStyleSheet((chloride <= 50 || chloride > 150) ? "background-color: red":"background-color: green"); |
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
|
387 | ui->wb_so4Edit->setStyleSheet((sulfate <= 50 || sulfate > 400) ? "background-color: red":"background-color: green"); |
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
|
388 | /* |
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
|
389 | * (cloride + sulfate) > 500 is too high |
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
|
390 | */ |
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
|
391 | if ((chloride + sulfate) > 500) { |
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
|
392 | ui->wb_clEdit->setStyleSheet("background-color: red"); |
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
|
393 | ui->wb_so4Edit->setStyleSheet("background-color: red"); |
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
|
394 | } |
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
|
395 | ui->wb_phEdit->setStyleSheet((ph < 5.2 || ph > 5.6) ? "background-color: red":"background-color: green"); |
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
|
396 | ui->wb_hco3Edit->setStyleSheet((bicarbonate > 250) ? "background-color: red":"background-color: green"); |
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
|
397 | ui->wb_caco3Edit->setStyleSheet((bicarbonate > 250) ? "background-color: red":"background-color: green"); |
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
|
398 | |
162 | 399 | calcSparge(); |
400 | } | |
401 | ||
402 | ||
403 | /* | |
404 | * Based on the work of ajDeLange. | |
405 | */ | |
406 | void EditRecipe::calcSparge() | |
407 | { | |
408 | double TargetpH = recipe->sparge_ph; | |
409 | double Source_pH = recipe->w1_ph; | |
410 | double Source_alkalinity = recipe->w1_total_alkalinity; | |
411 | ||
412 | qDebug() << "calcSparge()"; | |
413 | ||
414 | const QSignalBlocker blocker1(ui->sp_sourceEdit); | |
415 | ||
416 | // Select watersource or fallback to the first source. | |
417 | if (recipe->sparge_source == 1) { // Source 2 | |
418 | if (recipe->w2_ph > 0.0 && recipe->w2_amount > 0) { | |
419 | Source_pH = recipe->w2_ph; | |
420 | Source_alkalinity = recipe->w2_total_alkalinity; | |
421 | } else { | |
422 | recipe->sparge_source = 0; // Source 1 | |
423 | ui->sp_sourceEdit->setCurrentIndex(0); | |
424 | } | |
425 | } else if (recipe->sparge_source == 2) { // Mixed | |
426 | if (recipe->w2_ph > 0.0 && recipe->w2_amount > 0) { | |
427 | Source_pH = recipe->wg_ph; | |
428 | Source_alkalinity = recipe->wg_total_alkalinity; | |
429 | } else { | |
430 | recipe->sparge_source = 0; // Source 1 | |
431 | ui->sp_sourceEdit->setCurrentIndex(0); | |
432 | } | |
433 | } | |
434 | ||
435 | // Step 1: Compute the mole fractions of carbonic (f1o), bicarbonate (f2o) and carbonate(f3o) at the water pH | |
436 | double r1 = pow(10, Source_pH - 6.35); | |
437 | double r2 = pow(10, Source_pH - 10.33); | |
438 | double d = 1 + r1 + r1 * r2; | |
439 | double f1 = 1 / d; | |
440 | double f3 = r1 * r2 / d; | |
441 | ||
442 | // Step 2. Compute the mole fractions at pH = 4.3 (the pH which defines alkalinity) | |
443 | double r143 = pow(10, 4.3 - 6.35); | |
444 | double r243 = pow(10, 4.3 - 10.33); | |
445 | double d43 = 1 + r143 + r143 * r243; | |
446 | double f143 = 1 / d43; | |
447 | double f343 = r143 * r243 / d43; | |
448 | ||
449 | // Step 4. Solve | |
450 | //double Ct = (Source_alkalinity - 1000 * (pow(10, -4.3) - pow(10, -Source_pH))) / ((f143 - f1) + (f3 - f343)); | |
451 | double Ct = Source_alkalinity / 50 / ((f143 - f1) + (f3 - f343)); | |
452 | ||
453 | // Step 5. Compute mole fractions at desired pH | |
454 | double r1g = pow(10, TargetpH - 6.35); | |
455 | double r2g = pow(10, TargetpH - 10.33); | |
456 | double dg = 1 + r1g + r1g * r2g; | |
457 | double f1g = 1 / dg; | |
458 | double f3g = r1g * r2g / dg; | |
459 | ||
460 | // Step 6. Use these to compute the milliequivalents acid required per liter (mEq/L) | |
461 | double Acid = Ct * ((f1g - f1) + (f3 - f3g)) + pow(10, -TargetpH) - pow(10, -Source_pH); //mEq/l | |
462 | Acid += 0.01; // Add acid that would be required for distilled water. | |
463 | ||
464 | //Step 8. Get the acid data. | |
465 | int AT = recipe->sparge_acid_type; | |
466 | if (AT < 0 || AT >= my_acids.size()) { | |
467 | AT = 0; | |
468 | recipe->sparge_acid_type = 0; | |
469 | ui->sp_acidtypeEdit->setCurrentIndex(0); | |
470 | recipe->sparge_acid_perc = my_acids[0].AcidPrc; | |
471 | ui->sp_acidpercEdit->setValue(recipe->sparge_acid_perc); | |
472 | } | |
473 | double fract = Utils::CalcFrac(TargetpH, my_acids[AT].pK1, my_acids[AT].pK2, my_acids[AT].pK3); | |
474 | ||
475 | // Step 9. Now divide the mEq required by the "fraction". This is the required number of moles of acid. | |
476 | Acid /= fract; | |
477 | ||
478 | // Step 10. Multiply by molecular weight of the acid | |
479 | Acid *= my_acids[AT].MolWt; //mg | |
480 | ||
481 | // Step 11. Divide by Specific Gravity and Percentage to get the final ml. | |
482 | Acid = Acid / my_acids[AT].AcidSG / (recipe->sparge_acid_perc / 100); //ml | |
483 | Acid *= recipe->sparge_volume; //ml acid total | |
484 | Acid = round(Acid * 100.0) / 100.0; | |
485 | recipe->sparge_acid_amount = Acid / 1000; | |
486 | ui->sp_acidvolEdit->setValue(Acid); | |
487 | } | |
488 | ||
489 | ||
490 | void EditRecipe::sp_source_changed(int val) | |
491 | { | |
492 | recipe->sparge_source = val; | |
493 | calcSparge(); | |
494 | is_changed(); | |
495 | } | |
496 | ||
497 | ||
498 | void EditRecipe::sp_type_changed(int val) | |
499 | { | |
500 | recipe->sparge_acid_type = val; | |
501 | recipe->sparge_acid_perc = my_acids[val].AcidPrc; | |
502 | ui->sp_acidpercEdit->setValue(recipe->sparge_acid_perc); | |
503 | calcSparge(); | |
504 | is_changed(); | |
505 | } | |
506 | ||
507 | ||
508 | void EditRecipe::sp_ph_changed(double val) | |
509 | { | |
510 | recipe->sparge_ph = val; | |
511 | calcSparge(); | |
512 | is_changed(); | |
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
|
513 | } |
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
|
514 | |
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
|
515 | |
137
ffe8b2e9517b
Added indicators for BUGU and SO4:Cl ratio. Force rounded values for changing brewing salts.
Michiel Broek <mbroek@mbse.eu>
parents:
136
diff
changeset
|
516 | double EditRecipe::GetBUGU() |
ffe8b2e9517b
Added indicators for BUGU and SO4:Cl ratio. Force rounded values for changing brewing salts.
Michiel Broek <mbroek@mbse.eu>
parents:
136
diff
changeset
|
517 | { |
ffe8b2e9517b
Added indicators for BUGU and SO4:Cl ratio. Force rounded values for changing brewing salts.
Michiel Broek <mbroek@mbse.eu>
parents:
136
diff
changeset
|
518 | double gu = (recipe->est_og - 1) * 1000; |
ffe8b2e9517b
Added indicators for BUGU and SO4:Cl ratio. Force rounded values for changing brewing salts.
Michiel Broek <mbroek@mbse.eu>
parents:
136
diff
changeset
|
519 | if (gu > 0) |
ffe8b2e9517b
Added indicators for BUGU and SO4:Cl ratio. Force rounded values for changing brewing salts.
Michiel Broek <mbroek@mbse.eu>
parents:
136
diff
changeset
|
520 | return recipe->est_ibu / gu; |
ffe8b2e9517b
Added indicators for BUGU and SO4:Cl ratio. Force rounded values for changing brewing salts.
Michiel Broek <mbroek@mbse.eu>
parents:
136
diff
changeset
|
521 | return 0.5; |
ffe8b2e9517b
Added indicators for BUGU and SO4:Cl ratio. Force rounded values for changing brewing salts.
Michiel Broek <mbroek@mbse.eu>
parents:
136
diff
changeset
|
522 | } |
ffe8b2e9517b
Added indicators for BUGU and SO4:Cl ratio. Force rounded values for changing brewing salts.
Michiel Broek <mbroek@mbse.eu>
parents:
136
diff
changeset
|
523 | |
ffe8b2e9517b
Added indicators for BUGU and SO4:Cl ratio. Force rounded values for changing brewing salts.
Michiel Broek <mbroek@mbse.eu>
parents:
136
diff
changeset
|
524 | |
ffe8b2e9517b
Added indicators for BUGU and SO4:Cl ratio. Force rounded values for changing brewing salts.
Michiel Broek <mbroek@mbse.eu>
parents:
136
diff
changeset
|
525 | double EditRecipe::GetOptSO4Clratio() |
ffe8b2e9517b
Added indicators for BUGU and SO4:Cl ratio. Force rounded values for changing brewing salts.
Michiel Broek <mbroek@mbse.eu>
parents:
136
diff
changeset
|
526 | { |
ffe8b2e9517b
Added indicators for BUGU and SO4:Cl ratio. Force rounded values for changing brewing salts.
Michiel Broek <mbroek@mbse.eu>
parents:
136
diff
changeset
|
527 | if (ui->wt_so4Edit->value() > 0 && ui->wt_clEdit->value()) { |
ffe8b2e9517b
Added indicators for BUGU and SO4:Cl ratio. Force rounded values for changing brewing salts.
Michiel Broek <mbroek@mbse.eu>
parents:
136
diff
changeset
|
528 | /* If target water is selected .. */ |
ffe8b2e9517b
Added indicators for BUGU and SO4:Cl ratio. Force rounded values for changing brewing salts.
Michiel Broek <mbroek@mbse.eu>
parents:
136
diff
changeset
|
529 | return (ui->wt_so4Edit->value() / ui->wt_clEdit->value()); |
ffe8b2e9517b
Added indicators for BUGU and SO4:Cl ratio. Force rounded values for changing brewing salts.
Michiel Broek <mbroek@mbse.eu>
parents:
136
diff
changeset
|
530 | } |
ffe8b2e9517b
Added indicators for BUGU and SO4:Cl ratio. Force rounded values for changing brewing salts.
Michiel Broek <mbroek@mbse.eu>
parents:
136
diff
changeset
|
531 | double BUGU = GetBUGU(); |
ffe8b2e9517b
Added indicators for BUGU and SO4:Cl ratio. Force rounded values for changing brewing salts.
Michiel Broek <mbroek@mbse.eu>
parents:
136
diff
changeset
|
532 | return (-1.2 * BUGU + 1.4); |
ffe8b2e9517b
Added indicators for BUGU and SO4:Cl ratio. Force rounded values for changing brewing salts.
Michiel Broek <mbroek@mbse.eu>
parents:
136
diff
changeset
|
533 | } |
ffe8b2e9517b
Added indicators for BUGU and SO4:Cl ratio. Force rounded values for changing brewing salts.
Michiel Broek <mbroek@mbse.eu>
parents:
136
diff
changeset
|
534 | |
ffe8b2e9517b
Added indicators for BUGU and SO4:Cl ratio. Force rounded values for changing brewing salts.
Michiel Broek <mbroek@mbse.eu>
parents:
136
diff
changeset
|
535 | |
139
f947c6988e91
Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents:
138
diff
changeset
|
536 | void EditRecipe::mw_calc_acid_clicked() |
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
|
537 | { |
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
|
538 | recipe->calc_acid = ! recipe->calc_acid; |
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
|
539 | ui->mw_autoEdit->setChecked(recipe->calc_acid); |
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
|
540 | ui->mw_phEdit->setReadOnly(! recipe->calc_acid); |
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
|
541 | ui->mw_phEdit->setButtonSymbols(recipe->calc_acid ? QAbstractSpinBox::UpDownArrows : QAbstractSpinBox::NoButtons); |
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
|
542 | ui->mw_acidvolEdit->setReadOnly(recipe->calc_acid); |
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
|
543 | ui->mw_acidvolEdit->setButtonSymbols(recipe->calc_acid ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows); |
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
|
544 | is_changed(); |
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
|
545 | calcWater(); |
133
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
546 | } |
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
547 | |
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
548 | |
139
f947c6988e91
Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents:
138
diff
changeset
|
549 | void EditRecipe::mw_ph_changed(double val) |
133
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
550 | { |
136
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
551 | if (! recipe->calc_acid) |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
552 | return; |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
553 | |
139
f947c6988e91
Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents:
138
diff
changeset
|
554 | if (recipe->mash_ph != val) { |
f947c6988e91
Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents:
138
diff
changeset
|
555 | qDebug() << "mw_ph_changed" << val << recipe->mash_ph; |
f947c6988e91
Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents:
138
diff
changeset
|
556 | recipe->mash_ph = val; |
f947c6988e91
Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents:
138
diff
changeset
|
557 | is_changed(); |
f947c6988e91
Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents:
138
diff
changeset
|
558 | calcWater(); |
f947c6988e91
Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents:
138
diff
changeset
|
559 | } |
133
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
560 | } |
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
561 | |
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
562 | |
139
f947c6988e91
Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents:
138
diff
changeset
|
563 | void EditRecipe::mw_acid_changed(double val) |
133
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
564 | { |
136
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
565 | if (recipe->calc_acid) |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
566 | return; |
133
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
567 | |
136
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
568 | qDebug() << "on_mw_acid_changed" << val; |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
569 | QString w = my_acids[recipe->wa_acid_name].name_en + ' ' + my_acids[recipe->wa_acid_name].name_nl; |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
570 | set_brewing_salt(w, val); |
133
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
571 | } |
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
572 | |
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
573 | |
139
f947c6988e91
Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents:
138
diff
changeset
|
574 | void EditRecipe::mw_type_changed(int val) |
133
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
575 | { |
136
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
576 | if (val == recipe->wa_acid_name) |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
577 | return; |
133
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
578 | |
136
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
579 | qDebug() << "on_mw_type_changed" << val << "old" << recipe->wa_acid_name; |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
580 | /* |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
581 | * First remove current acid. |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
582 | */ |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
583 | QString w = my_acids[recipe->wa_acid_name].name_en + ' ' + my_acids[recipe->wa_acid_name].name_nl; |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
584 | brewing_salt_sub(w, 0); |
133
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
585 | |
136
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
586 | recipe->wa_acid_name = val; |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
587 | w = my_acids[recipe->wa_acid_name].name_en + ' ' + my_acids[recipe->wa_acid_name].name_nl; |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
588 | |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
589 | recipe->wa_acid_perc = my_acids.at(val).AcidPrc; |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
590 | ui->mw_acidpercEdit->setValue(my_acids.at(val).AcidPrc); |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
591 | brewing_salt_sub(w, ui->mw_acidvolEdit->value()); // For now, set old amount. |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
592 | |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
593 | is_changed(); |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
594 | calcWater(); |
133
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
595 | } |
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
596 | |
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
597 | |
139
f947c6988e91
Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents:
138
diff
changeset
|
598 | void EditRecipe::w2_volume_changed(double val) |
133
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
599 | { |
139
f947c6988e91
Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents:
138
diff
changeset
|
600 | qDebug() << "w2_vol_changed" << val; |
149
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
601 | |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
602 | if (recipe->w2_total_alkalinity && recipe->w2_sulfate) { |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
603 | /* |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
604 | * Seems a valid water, but don't go over the total. |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
605 | */ |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
606 | if (val < (recipe->w1_amount + recipe->w2_amount)) { |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
607 | recipe->w1_amount -= val - recipe->w2_amount; |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
608 | recipe->w2_amount = val; |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
609 | ui->w1_volEdit->setValue(recipe->w1_amount); |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
610 | } |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
611 | } else { |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
612 | /* |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
613 | * Invalid water, block changes. |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
614 | */ |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
615 | recipe->w2_amount = 0; |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
616 | } |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
617 | ui->w2_volEdit->setValue(recipe->w2_amount); |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
618 | |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
619 | calcWater(); |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
620 | is_changed(); |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
621 | } |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
622 | |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
623 | |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
624 | void EditRecipe::w1_name_changed(int val) |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
625 | { |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
626 | QSqlQuery query; |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
627 | |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
628 | qDebug() << "w1_name_changed" << val; |
152
58e4ce7dd217
Fixed vanishing mash profiles from some recipes. All ingnoreChanges flags removed and replaced by blocking signals. Update prompts and yeast amounts depending on the yeast form. Save water profile names fixed.
Michiel Broek <mbroek@mbse.eu>
parents:
150
diff
changeset
|
629 | const QSignalBlocker blocker1(ui->w1_nameEdit); |
149
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
630 | if (val == 0) { |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
631 | /* |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
632 | * If no water is selected, take the default water. |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
633 | */ |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
634 | val = my_default_water; |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
635 | ui->w1_nameEdit->setCurrentIndex(val); |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
636 | } |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
637 | |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
638 | query.prepare("SELECT * FROM inventory_waters ORDER BY record"); |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
639 | query.exec(); |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
640 | query.first(); |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
641 | for (int i = 0; i < (val - 1); i++) { |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
642 | query.next(); |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
643 | } |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
644 | qDebug() << "set water" << query.value(1).toString(); |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
645 | |
152
58e4ce7dd217
Fixed vanishing mash profiles from some recipes. All ingnoreChanges flags removed and replaced by blocking signals. Update prompts and yeast amounts depending on the yeast form. Save water profile names fixed.
Michiel Broek <mbroek@mbse.eu>
parents:
150
diff
changeset
|
646 | recipe->w1_name = query.value(1).toString(); |
149
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
647 | recipe->w1_calcium = query.value(3).toDouble(); |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
648 | recipe->w1_magnesium = query.value(8).toDouble(); |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
649 | recipe->w1_total_alkalinity = query.value(11).toDouble(); |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
650 | recipe->w1_sodium = query.value(7).toDouble(); |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
651 | recipe->w1_chloride = query.value(6).toDouble(); |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
652 | recipe->w1_sulfate = query.value(5).toDouble(); |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
653 | recipe->w1_ph = query.value(9).toDouble(); |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
654 | |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
655 | ui->w1_caEdit->setValue(recipe->w1_calcium); |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
656 | ui->w1_mgEdit->setValue(recipe->w1_magnesium); |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
657 | ui->w1_hco3Edit->setValue(recipe->w1_total_alkalinity * 1.22); |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
658 | ui->w1_caco3Edit->setValue(recipe->w1_total_alkalinity); |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
659 | ui->w1_naEdit->setValue(recipe->w1_sodium); |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
660 | ui->w1_clEdit->setValue(recipe->w1_chloride); |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
661 | ui->w1_so4Edit->setValue(recipe->w1_sulfate); |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
662 | ui->w1_phEdit->setValue(recipe->w1_ph); |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
663 | |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
664 | is_changed(); |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
665 | calcWater(); |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
666 | } |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
667 | |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
668 | |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
669 | void EditRecipe::w2_name_changed(int val) |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
670 | { |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
671 | QSqlQuery query; |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
672 | |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
673 | qDebug() << "w2_name_changed" << val; |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
674 | |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
675 | if (val == 0) { // Clear water 2. |
152
58e4ce7dd217
Fixed vanishing mash profiles from some recipes. All ingnoreChanges flags removed and replaced by blocking signals. Update prompts and yeast amounts depending on the yeast form. Save water profile names fixed.
Michiel Broek <mbroek@mbse.eu>
parents:
150
diff
changeset
|
676 | recipe->w2_name = ""; |
149
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
677 | recipe->w2_calcium = 0; |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
678 | recipe->w2_magnesium = 0; |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
679 | recipe->w2_total_alkalinity = 0; |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
680 | recipe->w2_sodium = 0; |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
681 | recipe->w2_chloride = 0; |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
682 | recipe->w2_sulfate = 0; |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
683 | recipe->w2_ph = 0; |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
684 | recipe->w1_amount += recipe->w2_amount; |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
685 | recipe->w2_amount = 0; |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
686 | } else { |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
687 | query.prepare("SELECT * FROM inventory_waters ORDER BY record"); |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
688 | query.exec(); |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
689 | query.first(); |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
690 | for (int i = 0; i < (val - 1); i++) { |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
691 | query.next(); |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
692 | } |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
693 | qDebug() << "set water" << query.value(1).toString(); |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
694 | |
152
58e4ce7dd217
Fixed vanishing mash profiles from some recipes. All ingnoreChanges flags removed and replaced by blocking signals. Update prompts and yeast amounts depending on the yeast form. Save water profile names fixed.
Michiel Broek <mbroek@mbse.eu>
parents:
150
diff
changeset
|
695 | recipe->w2_name = query.value(1).toString(); |
149
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
696 | recipe->w2_calcium = query.value(3).toDouble(); |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
697 | recipe->w2_magnesium = query.value(8).toDouble(); |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
698 | recipe->w2_total_alkalinity = query.value(11).toDouble(); |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
699 | recipe->w2_sodium = query.value(7).toDouble(); |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
700 | recipe->w2_chloride = query.value(6).toDouble(); |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
701 | recipe->w2_sulfate = query.value(5).toDouble(); |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
702 | recipe->w2_ph = query.value(9).toDouble(); |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
703 | } |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
704 | ui->w1_volEdit->setValue(recipe->w1_amount); |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
705 | ui->w2_volEdit->setValue(recipe->w2_amount); |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
706 | ui->w2_caEdit->setValue(recipe->w2_calcium); |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
707 | ui->w2_mgEdit->setValue(recipe->w2_magnesium); |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
708 | ui->w2_hco3Edit->setValue(recipe->w2_total_alkalinity * 1.22); |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
709 | ui->w2_caco3Edit->setValue(recipe->w2_total_alkalinity); |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
710 | ui->w2_naEdit->setValue(recipe->w2_sodium); |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
711 | ui->w2_clEdit->setValue(recipe->w2_chloride); |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
712 | ui->w2_so4Edit->setValue(recipe->w2_sulfate); |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
713 | ui->w2_phEdit->setValue(recipe->w2_ph); |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
714 | |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
715 | is_changed(); |
d73719fa2ebb
Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents:
139
diff
changeset
|
716 | calcWater(); |
133
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
717 | } |
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
718 | |
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
719 | |
139
f947c6988e91
Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents:
138
diff
changeset
|
720 | void EditRecipe::wt_target_changed(int val) |
138
1189d072f346
Add select target water profile. The mash part of the water tab is ready.
Michiel Broek <mbroek@mbse.eu>
parents:
137
diff
changeset
|
721 | { |
1189d072f346
Add select target water profile. The mash part of the water tab is ready.
Michiel Broek <mbroek@mbse.eu>
parents:
137
diff
changeset
|
722 | QSqlQuery query; |
1189d072f346
Add select target water profile. The mash part of the water tab is ready.
Michiel Broek <mbroek@mbse.eu>
parents:
137
diff
changeset
|
723 | |
1189d072f346
Add select target water profile. The mash part of the water tab is ready.
Michiel Broek <mbroek@mbse.eu>
parents:
137
diff
changeset
|
724 | if (val == 0) { |
1189d072f346
Add select target water profile. The mash part of the water tab is ready.
Michiel Broek <mbroek@mbse.eu>
parents:
137
diff
changeset
|
725 | /* Clear values */ |
1189d072f346
Add select target water profile. The mash part of the water tab is ready.
Michiel Broek <mbroek@mbse.eu>
parents:
137
diff
changeset
|
726 | ui->wt_caEdit->setValue(0); |
1189d072f346
Add select target water profile. The mash part of the water tab is ready.
Michiel Broek <mbroek@mbse.eu>
parents:
137
diff
changeset
|
727 | ui->wt_mgEdit->setValue(0); |
1189d072f346
Add select target water profile. The mash part of the water tab is ready.
Michiel Broek <mbroek@mbse.eu>
parents:
137
diff
changeset
|
728 | ui->wt_hco3Edit->setValue(0); |
1189d072f346
Add select target water profile. The mash part of the water tab is ready.
Michiel Broek <mbroek@mbse.eu>
parents:
137
diff
changeset
|
729 | ui->wt_caco3Edit->setValue(0); |
1189d072f346
Add select target water profile. The mash part of the water tab is ready.
Michiel Broek <mbroek@mbse.eu>
parents:
137
diff
changeset
|
730 | ui->wt_naEdit->setValue(0); |
1189d072f346
Add select target water profile. The mash part of the water tab is ready.
Michiel Broek <mbroek@mbse.eu>
parents:
137
diff
changeset
|
731 | ui->wt_clEdit->setValue(0); |
1189d072f346
Add select target water profile. The mash part of the water tab is ready.
Michiel Broek <mbroek@mbse.eu>
parents:
137
diff
changeset
|
732 | ui->wt_so4Edit->setValue(0); |
1189d072f346
Add select target water profile. The mash part of the water tab is ready.
Michiel Broek <mbroek@mbse.eu>
parents:
137
diff
changeset
|
733 | } else { |
1189d072f346
Add select target water profile. The mash part of the water tab is ready.
Michiel Broek <mbroek@mbse.eu>
parents:
137
diff
changeset
|
734 | query.prepare("SELECT * FROM profile_water ORDER BY name"); |
1189d072f346
Add select target water profile. The mash part of the water tab is ready.
Michiel Broek <mbroek@mbse.eu>
parents:
137
diff
changeset
|
735 | query.exec(); |
1189d072f346
Add select target water profile. The mash part of the water tab is ready.
Michiel Broek <mbroek@mbse.eu>
parents:
137
diff
changeset
|
736 | query.first(); |
1189d072f346
Add select target water profile. The mash part of the water tab is ready.
Michiel Broek <mbroek@mbse.eu>
parents:
137
diff
changeset
|
737 | for (int i = 0; i < (val - 1); i++) { |
1189d072f346
Add select target water profile. The mash part of the water tab is ready.
Michiel Broek <mbroek@mbse.eu>
parents:
137
diff
changeset
|
738 | query.next(); |
1189d072f346
Add select target water profile. The mash part of the water tab is ready.
Michiel Broek <mbroek@mbse.eu>
parents:
137
diff
changeset
|
739 | } |
1189d072f346
Add select target water profile. The mash part of the water tab is ready.
Michiel Broek <mbroek@mbse.eu>
parents:
137
diff
changeset
|
740 | ui->wt_caEdit->setValue(query.value(2).toDouble()); |
1189d072f346
Add select target water profile. The mash part of the water tab is ready.
Michiel Broek <mbroek@mbse.eu>
parents:
137
diff
changeset
|
741 | ui->wt_mgEdit->setValue(query.value(7).toDouble()); |
1189d072f346
Add select target water profile. The mash part of the water tab is ready.
Michiel Broek <mbroek@mbse.eu>
parents:
137
diff
changeset
|
742 | ui->wt_hco3Edit->setValue(query.value(3).toDouble()); |
1189d072f346
Add select target water profile. The mash part of the water tab is ready.
Michiel Broek <mbroek@mbse.eu>
parents:
137
diff
changeset
|
743 | ui->wt_caco3Edit->setValue(query.value(10).toDouble()); |
1189d072f346
Add select target water profile. The mash part of the water tab is ready.
Michiel Broek <mbroek@mbse.eu>
parents:
137
diff
changeset
|
744 | ui->wt_naEdit->setValue(query.value(6).toDouble()); |
1189d072f346
Add select target water profile. The mash part of the water tab is ready.
Michiel Broek <mbroek@mbse.eu>
parents:
137
diff
changeset
|
745 | ui->wt_clEdit->setValue(query.value(5).toDouble()); |
1189d072f346
Add select target water profile. The mash part of the water tab is ready.
Michiel Broek <mbroek@mbse.eu>
parents:
137
diff
changeset
|
746 | ui->wt_so4Edit->setValue(query.value(4).toDouble()); |
1189d072f346
Add select target water profile. The mash part of the water tab is ready.
Michiel Broek <mbroek@mbse.eu>
parents:
137
diff
changeset
|
747 | } |
1189d072f346
Add select target water profile. The mash part of the water tab is ready.
Michiel Broek <mbroek@mbse.eu>
parents:
137
diff
changeset
|
748 | calcWater(); |
1189d072f346
Add select target water profile. The mash part of the water tab is ready.
Michiel Broek <mbroek@mbse.eu>
parents:
137
diff
changeset
|
749 | } |
1189d072f346
Add select target water profile. The mash part of the water tab is ready.
Michiel Broek <mbroek@mbse.eu>
parents:
137
diff
changeset
|
750 | |
1189d072f346
Add select target water profile. The mash part of the water tab is ready.
Michiel Broek <mbroek@mbse.eu>
parents:
137
diff
changeset
|
751 | |
150
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
149
diff
changeset
|
752 | void EditRecipe::adjustWaters(double factor) |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
149
diff
changeset
|
753 | { |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
149
diff
changeset
|
754 | int i; |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
149
diff
changeset
|
755 | double amount; |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
149
diff
changeset
|
756 | |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
149
diff
changeset
|
757 | if (recipe->mashs.size() == 0) |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
149
diff
changeset
|
758 | return; |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
149
diff
changeset
|
759 | |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
149
diff
changeset
|
760 | double mash_infuse = 0; |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
149
diff
changeset
|
761 | for (i = 0; i < recipe->mashs.size(); i++) { |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
149
diff
changeset
|
762 | if (recipe->mashs.at(i).step_type == 0) { // Infusion |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
149
diff
changeset
|
763 | amount = round(recipe->mashs.at(i).step_infuse_amount * factor * 1000000.0) / 1000000.0; |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
149
diff
changeset
|
764 | recipe->mashs[i].step_infuse_amount = amount; |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
149
diff
changeset
|
765 | mash_infuse += amount; |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
149
diff
changeset
|
766 | recipe->mashs[i].step_volume = mash_infuse; |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
149
diff
changeset
|
767 | } |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
149
diff
changeset
|
768 | } |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
149
diff
changeset
|
769 | |
152
58e4ce7dd217
Fixed vanishing mash profiles from some recipes. All ingnoreChanges flags removed and replaced by blocking signals. Update prompts and yeast amounts depending on the yeast form. Save water profile names fixed.
Michiel Broek <mbroek@mbse.eu>
parents:
150
diff
changeset
|
770 | const QSignalBlocker blocker1(ui->w1_volEdit); |
58e4ce7dd217
Fixed vanishing mash profiles from some recipes. All ingnoreChanges flags removed and replaced by blocking signals. Update prompts and yeast amounts depending on the yeast form. Save water profile names fixed.
Michiel Broek <mbroek@mbse.eu>
parents:
150
diff
changeset
|
771 | const QSignalBlocker blocker2(ui->w2_volEdit); |
58e4ce7dd217
Fixed vanishing mash profiles from some recipes. All ingnoreChanges flags removed and replaced by blocking signals. Update prompts and yeast amounts depending on the yeast form. Save water profile names fixed.
Michiel Broek <mbroek@mbse.eu>
parents:
150
diff
changeset
|
772 | |
150
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
149
diff
changeset
|
773 | if (recipe->w2_amount == 0) { |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
149
diff
changeset
|
774 | recipe->w1_amount = mash_infuse; |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
149
diff
changeset
|
775 | ui->w1_volEdit->setValue(mash_infuse); |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
149
diff
changeset
|
776 | } else { |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
149
diff
changeset
|
777 | double w1 = (recipe->w1_amount / (recipe->w1_amount + recipe->w2_amount)) * mash_infuse; |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
149
diff
changeset
|
778 | double w2 = (recipe->w2_amount / (recipe->w1_amount + recipe->w2_amount)) * mash_infuse; |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
149
diff
changeset
|
779 | recipe->w1_amount = w1; |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
149
diff
changeset
|
780 | recipe->w2_amount = w2; |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
149
diff
changeset
|
781 | ui->w1_volEdit->setValue(recipe->w1_amount); |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
149
diff
changeset
|
782 | ui->w2_volEdit->setValue(recipe->w2_amount); |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
149
diff
changeset
|
783 | } |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
149
diff
changeset
|
784 | recipe->wg_amount = mash_infuse; |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
149
diff
changeset
|
785 | ui->wg_volEdit->setValue(mash_infuse); |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
149
diff
changeset
|
786 | } |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
149
diff
changeset
|
787 | |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
149
diff
changeset
|
788 | |
139
f947c6988e91
Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents:
138
diff
changeset
|
789 | void EditRecipe::wb_cacl2_changed(double val) { set_brewing_salt("CaCl2", val); } |
f947c6988e91
Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents:
138
diff
changeset
|
790 | void EditRecipe::wb_caso4_changed(double val) { set_brewing_salt("CaSO4", val); } |
f947c6988e91
Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents:
138
diff
changeset
|
791 | void EditRecipe::wb_mgso4_changed(double val) { set_brewing_salt("MgSO4", val); } |
f947c6988e91
Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents:
138
diff
changeset
|
792 | void EditRecipe::wb_nacl_changed(double val) { set_brewing_salt("NaCl", val); } |
f947c6988e91
Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents:
138
diff
changeset
|
793 | void EditRecipe::wb_mgcl2_changed(double val) { set_brewing_salt("MgCl2", val); } |
f947c6988e91
Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents:
138
diff
changeset
|
794 | void EditRecipe::wb_nahco3_changed(double val) { set_brewing_salt("NaHCO3", val); } |
f947c6988e91
Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents:
138
diff
changeset
|
795 | void EditRecipe::wb_caco3_changed(double val) { set_brewing_salt("CaCO3", val); } |
133
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
796 | |
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
797 |