217 } |
217 } |
218 qDebug() << " adjust to 100" << recipe->fermentables_use100; |
218 qDebug() << " adjust to 100" << recipe->fermentables_use100; |
219 |
219 |
220 recipe->mashs_kg = 0; |
220 recipe->mashs_kg = 0; |
221 for (i = 0; i < recipe->fermentables.size(); i++) { |
221 for (i = 0; i < recipe->fermentables.size(); i++) { |
222 if (recipe->fermentables.at(i).type == 1 && recipe->fermentables.at(i).added < 4) // Sugars |
222 if (recipe->fermentables.at(i).type == FERMENTABLE_TYPE_SUGAR && recipe->fermentables.at(i).added < FERMENTABLE_ADDED_BOTTLE) |
223 psugar += recipe->fermentables.at(i).percentage; |
223 psugar += recipe->fermentables.at(i).percentage; |
224 if (recipe->fermentables.at(i).graintype == 2 && recipe->fermentables.at(i).added < 4) // Crystal/Cara |
224 if (recipe->fermentables.at(i).graintype == FERMENTABLE_GRAINTYPE_CRYSTAL && recipe->fermentables.at(i).added < FERMENTABLE_ADDED_BOTTLE) |
225 pcara += recipe->fermentables.at(i).percentage; |
225 pcara += recipe->fermentables.at(i).percentage; |
226 d = recipe->fermentables.at(i).amount * (recipe->fermentables.at(i).yield / 100) * (1 - recipe->fermentables.at(i).moisture / 100); |
226 d = recipe->fermentables.at(i).amount * (recipe->fermentables.at(i).yield / 100) * (1 - recipe->fermentables.at(i).moisture / 100); |
227 if (recipe->fermentables.at(i).added == 0) { // Mash |
227 if (recipe->fermentables.at(i).added == FERMENTABLE_ADDED_MASH) { |
228 if (mvol > 0) { // If mash volume is known |
228 if (mvol > 0) { // If mash volume is known |
229 mvol += recipe->fermentables.at(i).amount * recipe->fermentables.at(i).moisture / 100; |
229 mvol += recipe->fermentables.at(i).amount * recipe->fermentables.at(i).moisture / 100; |
230 s += d; |
230 s += d; |
231 } |
231 } |
232 d = ui->efficiencyEdit->value() / 100 * d; |
232 d = ui->efficiencyEdit->value() / 100 * d; |
233 sugarsm += d; |
233 sugarsm += d; |
234 recipe->mashs_kg += recipe->fermentables.at(i).amount; |
234 recipe->mashs_kg += recipe->fermentables.at(i).amount; |
235 } |
235 } |
236 if (recipe->fermentables.at(i).added == 0 || recipe->fermentables.at(i).added == 1) // Mash or boil |
236 if (recipe->fermentables.at(i).added == FERMENTABLE_ADDED_MASH || recipe->fermentables.at(i).added == FERMENTABLE_ADDED_BOIL) |
237 sugarsf += d; |
237 sugarsf += d; |
238 if (recipe->fermentables.at(i).added == 2 || recipe->fermentables.at(i).added == 3) { // Fermentation or lagering |
238 if (recipe->fermentables.at(i).added == FERMENTABLE_ADDED_FERMENTATION || recipe->fermentables.at(i).added == FERMENTABLE_ADDED_LAGERING) { |
239 x = (recipe->fermentables.at(i).yield / 100) * (1 - recipe->fermentables.at(i).moisture / 100); |
239 x = (recipe->fermentables.at(i).yield / 100) * (1 - recipe->fermentables.at(i).moisture / 100); |
240 addedS += recipe->fermentables.at(i).amount * x; |
240 addedS += recipe->fermentables.at(i).amount * x; |
241 addedmass += recipe->fermentables.at(i).amount; |
241 addedmass += recipe->fermentables.at(i).amount; |
242 vol += (x * sugardensity + (1 - x) * 1) * recipe->fermentables.at(i).amount; |
242 vol += (x * sugardensity + (1 - x) * 1) * recipe->fermentables.at(i).amount; |
243 } |
243 } |
244 if (recipe->fermentables.at(i).added == 0 && |
244 if (recipe->fermentables.at(i).added == FERMENTABLE_ADDED_MASH && |
245 (recipe->fermentables.at(i).type == 0 || recipe->fermentables.at(i).type == 4) && |
245 (recipe->fermentables.at(i).type == FERMENTABLE_TYPE_GRAIN || recipe->fermentables.at(i).type == FERMENTABLE_TYPE_ADJUCT)) { |
246 recipe->fermentables.at(i).color < 50) { |
|
247 lintner += recipe->fermentables.at(i).diastatic_power * recipe->fermentables.at(i).amount; |
246 lintner += recipe->fermentables.at(i).diastatic_power * recipe->fermentables.at(i).amount; |
248 } |
247 } |
249 if (recipe->fermentables.at(i).added < 4) { |
248 if (recipe->fermentables.at(i).added < FERMENTABLE_ADDED_BOTTLE) { |
250 colort += recipe->fermentables.at(i).amount * Utils::ebc_to_srm(recipe->fermentables.at(i).color); |
249 colort += recipe->fermentables.at(i).amount * Utils::ebc_to_srm(recipe->fermentables.at(i).color); |
251 colorh += recipe->fermentables.at(i).amount * recipe->fermentables.at(i).color * Utils::get_kt(recipe->fermentables.at(i).color); |
250 colorh += recipe->fermentables.at(i).amount * recipe->fermentables.at(i).color * Utils::get_kt(recipe->fermentables.at(i).color); |
252 colorn += (recipe->fermentables.at(i).percentage / 100) * recipe->fermentables.at(i).color; // For 8.6 Pt wort. |
251 colorn += (recipe->fermentables.at(i).percentage / 100) * recipe->fermentables.at(i).color; // For 8.6 Pt wort. |
253 } |
252 } |
254 } |
253 } |