src/EditRecipeTab7.cpp

changeset 283
242a68fa7186
parent 162
19156b8b339f
child 350
37b3c690b02c
equal deleted inserted replaced
282:d1d208a857b0 283:242a68fa7186
59 59
60 double EditRecipe::BufferCapacity(Fermentables F) 60 double EditRecipe::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 0: // Base, Special, Kilned 71 case 0: // Base, Special, Kilned
72 case 3: 72 case 3:
73 case 5: C1 = 0.014 * F.f_color - 34.192; 73 case 5: C1 = 0.014 * F.color - 34.192;
74 break; 74 break;
75 case 2: C1 = -0.0597 * F.f_color - 32.457; // Crystal 75 case 2: C1 = -0.0597 * F.color - 32.457; // Crystal
76 break; 76 break;
77 case 1: C1 = 0.0107 * F.f_color - 54.768; // Roast 77 case 1: C1 = 0.0107 * F.color - 54.768; // Roast
78 break; 78 break;
79 case 4: C1 = -149; // Sour malt 79 case 4: C1 = -149; // Sour malt
80 break; 80 break;
81 } 81 }
82 } 82 }
85 85
86 86
87 double EditRecipe::AcidRequired(double ZpH, Fermentables F) 87 double EditRecipe::AcidRequired(double ZpH, Fermentables F)
88 { 88 {
89 double C1 = BufferCapacity(F); 89 double C1 = BufferCapacity(F);
90 double x = F.f_di_ph; 90 double x = F.di_ph;
91 return C1 * (ZpH - x); 91 return C1 * (ZpH - x);
92 } 92 }
93 93
94 94
95 double EditRecipe::ProtonDeficit(double pHZ) 95 double EditRecipe::ProtonDeficit(double pHZ)
103 * proton deficit for the grist 103 * proton deficit for the grist
104 */ 104 */
105 if (recipe->fermentables.size()) { 105 if (recipe->fermentables.size()) {
106 for (i = 0; i < recipe->fermentables.size(); i++) { 106 for (i = 0; i < recipe->fermentables.size(); i++) {
107 F = recipe->fermentables.at(i); 107 F = recipe->fermentables.at(i);
108 if (F.f_added == 0 && F.f_graintype != 6) { // Added == Mash && graintype != No Malt 108 if (F.added == 0 && F.graintype != 6) { // Added == Mash && 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++;

mercurial