59 |
59 |
60 double EditProduct::BufferCapacity(Fermentables F) |
60 double EditProduct::BufferCapacity(Fermentables F) |
61 { |
61 { |
62 double C1 = 0; |
62 double C1 = 0; |
63 |
63 |
64 if ((F.f_di_ph != 5.7) && ((F.f_acid_to_ph_57 < - 0.1) || (F.f_acid_to_ph_57 > 0.1))) { |
64 if ((F.di_ph != 5.7) && ((F.acid_to_ph_57 < - 0.1) || (F.acid_to_ph_57 > 0.1))) { |
65 C1 = F.f_acid_to_ph_57 / (F.f_di_ph - 5.7); |
65 C1 = F.acid_to_ph_57 / (F.di_ph - 5.7); |
66 } else { |
66 } else { |
67 /* |
67 /* |
68 * If the acid_to_ph_5.7 is unknown from the maltster, guess the required acid. |
68 * If the acid_to_ph_5.7 is unknown from the maltster, guess the required acid. |
69 */ |
69 */ |
70 switch (F.f_graintype) { |
70 switch (F.graintype) { |
71 case FERMENTABLE_GRAINTYPE_BASE: |
71 case FERMENTABLE_GRAINTYPE_BASE: |
72 case FERMENTABLE_GRAINTYPE_KILNED: |
72 case FERMENTABLE_GRAINTYPE_KILNED: |
73 case FERMENTABLE_GRAINTYPE_SPECIAL: C1 = 0.014 * F.f_color - 34.192; |
73 case FERMENTABLE_GRAINTYPE_SPECIAL: C1 = 0.014 * F.color - 34.192; |
74 break; |
74 break; |
75 case FERMENTABLE_GRAINTYPE_CRYSTAL: C1 = -0.0597 * F.f_color - 32.457; |
75 case FERMENTABLE_GRAINTYPE_CRYSTAL: C1 = -0.0597 * F.color - 32.457; |
76 break; |
76 break; |
77 case FERMENTABLE_GRAINTYPE_ROAST: C1 = 0.0107 * F.f_color - 54.768; |
77 case FERMENTABLE_GRAINTYPE_ROAST: C1 = 0.0107 * F.color - 54.768; |
78 break; |
78 break; |
79 case FERMENTABLE_GRAINTYPE_SOUR_MALT: C1 = -149; |
79 case FERMENTABLE_GRAINTYPE_SOUR_MALT: C1 = -149; |
80 break; |
80 break; |
81 } |
81 } |
82 } |
82 } |
103 * proton deficit for the grist |
103 * proton deficit for the grist |
104 */ |
104 */ |
105 if (product->fermentables.size()) { |
105 if (product->fermentables.size()) { |
106 for (i = 0; i < product->fermentables.size(); i++) { |
106 for (i = 0; i < product->fermentables.size(); i++) { |
107 F = product->fermentables.at(i); |
107 F = product->fermentables.at(i); |
108 if (F.f_added == FERMENTABLE_ADDED_MASH && F.f_graintype != FERMENTABLE_GRAINTYPE_NO_MALT) { |
108 if (F.added == FERMENTABLE_ADDED_MASH && F.graintype != FERMENTABLE_GRAINTYPE_NO_MALT) { |
109 x = AcidRequired(pHZ, F) * F.f_amount; |
109 x = AcidRequired(pHZ, F) * F.amount; |
110 Result += x; |
110 Result += x; |
111 } |
111 } |
112 } |
112 } |
113 } else { |
113 } else { |
114 error_count++; |
114 error_count++; |