www/js/global.js

changeset 92
fab98e5c86fc
parent 70
4da2414eabbc
child 94
295c3af2a421
equal deleted inserted replaced
91:44981507b781 92:fab98e5c86fc
84 84
85 85
86 /* 86 /*
87 * Berekeningen uit https://www.hobbybrouwen.nl/forum/index.php/topic,6079.msg69464.html#msg69464 87 * Berekeningen uit https://www.hobbybrouwen.nl/forum/index.php/topic,6079.msg69464.html#msg69464
88 */ 88 */
89 function toIBU_Tinseth(Use, Form, SG, Volume, Amount, Boiltime, Alpha) { 89 function toIBU(Use, Form, SG, Volume, Amount, Boiltime, Alpha, Method) {
90 var gravity = parseFloat(SG); 90 var gravity = parseFloat(SG);
91 var liters = parseFloat(Volume); 91 var liters = parseFloat(Volume);
92 var alpha = parseFloat(Alpha)/100; 92 var alpha = parseFloat(Alpha)/100;
93 var mass = parseFloat(Amount) * 1000; 93 var mass = parseFloat(Amount) * 1000;
94 var time = parseFloat(Boiltime); 94 var time = parseFloat(Boiltime);
95 var fmoment = 1.0; 95 var fmoment = 1.0;
96 var pfactor = 1.0; 96 var pfactor = 1.0;
97 var ibu = 0;
97 98
98 if ((Use == "Dry Hop") || (Use == "Dry hop")) { 99 console.log("toIBU_Tinseth("+Use+"," + Form + "," + SG + "," + Volume + "," + Amount + "," + Boiltime + "," + Alpha + "," + Method + ")");
99 fmoment = 0.0; 100
100 } else if (Use == "Whirlpool") { 101 if ((Use == "Dry Hop") || (Use == "Dry hop") || (Use == "Whirlpool") || (Use == "Aroma")) {
101 fmoment = 0.0; 102 fmoment = 0.0;
102 } else if (Use == "Mash") { 103 } else if (Use == "Mash") {
103 fmoment = 0.7; // Brouwhulp 104 fmoment += /* Settings.MashHopFactor.Value = -30% */ -30 / 100; // Brouwhulp
104 } else if ((Use == "First Wort") || (Use == "First wort")) { 105 } else if ((Use == "First Wort") || (Use == "First wort")) {
105 fmoment = 1.1; // Brouwhulp, Louis, Ozzie 106 fmoment += /* Settings.FWHFactor.Value = 10% */ 10 / 100; // Brouwhulp, Louis, Ozzie
106 } else if (Use == "Aroma") {
107 fmoment = 0.0;
108 } 107 }
109 108
110 if (Form == "Pellet") { 109 if (Form == "Pellet") {
111 pfactor = 1.1; 110 pfactor += /* Settings.PelletFactor.Value = 10% */ 10 / 100;
111 }
112 if (Form == "Plug" ) {
113 pfactor += /* Settings.PlugFactor.Value = 2% */ 2 / 100;
112 } 114 }
113 115
114 // TODO: sg = (postBoilGravity - 1.0) * batchSize / boilSize; 116 // TODO: sg = (postBoilGravity - 1.0) * batchSize / boilSize;
115 117
116 /* 118 if (Method == "Tinseth") {
117 * http://realbeer.com/hops/research.html 119 /*
118 * 120 * http://realbeer.com/hops/research.html
119 * decimal AA rating * grams hops * 1000 121 *
120 * mg/l of added alpha acids = ------------------------------------- 122 * decimal AA rating * grams hops * 1000
121 * volume of finished beer in liters 123 * mg/l of added alpha acids = -------------------------------------
122 * 124 * volume of finished beer in liters
123 * Bigness factor = 1.65 * 0.000125^(wort gravity - 1) 125 *
124 * 126 * Bigness factor = 1.65 * 0.000125^(wort gravity - 1)
125 * 1 - e^(-0.04 * time in mins) 127 *
126 * Boil Time factor = ---------------------------- 128 * 1 - e^(-0.04 * time in mins)
127 * 4.15 129 * Boil Time factor = ----------------------------
128 * 130 * 4.15
129 * decimal alpha acid utilization = Bigness factor * Boil Time factor 131 *
130 * 132 * decimal alpha acid utilization = Bigness factor * Boil Time factor
131 * IBUs = decimal alpha acid utilization * mg/l of added alpha acids 133 *
132 */ 134 * IBUs = decimal alpha acid utilization * mg/l of added alpha acids
133 var AddedAlphaAcids = (alpha * mass * 1000) / liters; 135 */
134 var Bigness_factor = 1.65 * Math.pow( 0.000125, gravity - 1); 136 var AddedAlphaAcids = (alpha * mass * 1000) / liters;
135 var BoilTime_factor = ((1 - Math.exp(-0.04 * time)) / 4.15); // Glen Tinseth 137 var Bigness_factor = 1.65 * Math.pow( 0.000125, gravity - 1);
136 var utiisation = Bigness_factor * BoilTime_factor; 138 var BoilTime_factor = ((1 - Math.exp(-0.04 * time)) / 4.15); // Glen Tinseth
139 var utiisation = Bigness_factor * BoilTime_factor;
137 140
138 console.log(" AddedAlphaAcids:"+AddedAlphaAcids+" Bigness_factor:"+Bigness_factor+" BoilTime_factor:"+BoilTime_factor+" utilisation:"+utiisation); 141 console.log(" AddedAlphaAcids:"+AddedAlphaAcids+" Bigness_factor:"+Bigness_factor+" BoilTime_factor:"+BoilTime_factor+" utilisation:"+utiisation);
139 console.log(" fmoment:"+fmoment+" pfactor:"+pfactor); 142 ibu = Math.round(utiisation * AddedAlphaAcids * fmoment * pfactor * 10) / 10.0;
143 }
144 if (Method == "Daniels") {
145 var boilfactor;
146 var sgfactor;
147 if (Form == "Leaf")
148 boilfactor = -(0.0041*time*time)+(0.6162*time)+1.5779;
149 else
150 boilfactor = -(0.0051*time*time)+(0.7835*time)+1.9348;
151 if (gravity < 1050)
152 sgfactor = 0;
153 else
154 sgfactor = (gravity - 1050) / 200;
155 ibu = Math.round(fmoment * ((mass * (alpha * 100) * boilfactor * 0.1) / (liters * (1 + sgfactor))) * 10) / 10;
156 }
157 if (Method == "Rager") {
158 var boilfactor;
159 var sgfactor;
160 boilfactor = fmoment * 18.11 + 13.86 * Math.tanh((time * 31.32) / 18.27);
161 if (gravity < 1050)
162 sgfactor = 0;
163 else
164 sgfactor = (gravity - 1050) / 200;
165 ibu = Math.round((mass * (alpha * 100) * boilfactor * 0.1) / (liters * (1 + sgfactor)) * 10) / 10;
166 }
140 167
141 var ibu = (Math.round(utiisation * AddedAlphaAcids * fmoment * pfactor * 10) / 10.0); 168 console.log(" fmoment:"+fmoment+" pfactor:"+pfactor+" IBU:"+ibu);
142 return ibu; 169 return ibu;
143 } 170 }
144 171
145
146
147 function toIBU(Use, Form, SG, Volume, Amount, Boiltime, Alpha, Method) {
148
149 console.log("toIBU_Tinseth("+Use+"," + Form + "," + SG + "," + Volume + "," + Amount + "," + Boiltime + "," + Alpha + "," + Method + ")");
150 return toIBU_Tinseth(Use, Form, SG, Volume, Amount, Boiltime, Alpha);
151 }
152 172
153 173
154 /* 174 /*
155 * Steinie: 175 * Steinie:
156 * 176 *

mercurial