222 double result = 0; |
222 double result = 0; |
223 |
223 |
224 if (product->fermentables.size() == 0) |
224 if (product->fermentables.size() == 0) |
225 return; // no fermentables loaded yet |
225 return; // no fermentables loaded yet |
226 for (int i = 0; i < product->fermentables.size(); i++) { |
226 for (int i = 0; i < product->fermentables.size(); i++) { |
227 if (product->fermentables.at(i).f_added == FERMENTABLE_ADDED_MASH) { |
227 if (product->fermentables.at(i).added == FERMENTABLE_ADDED_MASH) { |
228 m += product->fermentables.at(i).f_amount * (product->fermentables.at(i).f_yield / 100) * (1 - product->fermentables.at(i).f_moisture / 100); |
228 m += product->fermentables.at(i).amount * (product->fermentables.at(i).yield / 100) * (1 - product->fermentables.at(i).moisture / 100); |
229 } |
229 } |
230 } |
230 } |
231 tot = Utils::sg_to_plato(product->brew_preboil_sg) * (product->brew_preboil_volume / 1.04) * product->brew_preboil_sg * 10 / 1000; |
231 tot = Utils::sg_to_plato(product->brew_preboil_sg) * (product->brew_preboil_volume / 1.04) * product->brew_preboil_sg * 10 / 1000; |
232 |
232 |
233 if (m > 0) |
233 if (m > 0) |
304 double result = 0; |
304 double result = 0; |
305 |
305 |
306 if (product->fermentables.size() == 0) |
306 if (product->fermentables.size() == 0) |
307 return; // no fermentables loaded yet |
307 return; // no fermentables loaded yet |
308 for (int i = 0; i < product->fermentables.size(); i++) { |
308 for (int i = 0; i < product->fermentables.size(); i++) { |
309 if (product->fermentables.at(i).f_added == FERMENTABLE_ADDED_MASH) { |
309 if (product->fermentables.at(i).added == FERMENTABLE_ADDED_MASH) { |
310 m += product->fermentables.at(i).f_amount * (product->fermentables.at(i).f_yield / 100) * (1 - product->fermentables.at(i).f_moisture / 100); |
310 m += product->fermentables.at(i).amount * (product->fermentables.at(i).yield / 100) * (1 - product->fermentables.at(i).moisture / 100); |
311 } else if (product->fermentables.at(i).f_added == FERMENTABLE_ADDED_BOIL) { |
311 } else if (product->fermentables.at(i).added == FERMENTABLE_ADDED_BOIL) { |
312 b += product->fermentables.at(i).f_amount * (product->fermentables.at(i).f_yield / 100) * (1 - product->fermentables.at(i).f_moisture / 100); |
312 b += product->fermentables.at(i).amount * (product->fermentables.at(i).yield / 100) * (1 - product->fermentables.at(i).moisture / 100); |
313 } |
313 } |
314 } |
314 } |
315 double tot = Utils::sg_to_plato(product->brew_aboil_sg) * (product->brew_aboil_volume / 1.04) * product->brew_aboil_sg * 10 / 1000; |
315 double tot = Utils::sg_to_plato(product->brew_aboil_sg) * (product->brew_aboil_volume / 1.04) * product->brew_aboil_sg * 10 / 1000; |
316 tot -= b; // total sugars in wort minus added sugars. |
316 tot -= b; // total sugars in wort minus added sugars. |
317 |
317 |