98 |
100 |
99 function hopFlavourContribution(bt, vol, use, amount) { |
101 function hopFlavourContribution(bt, vol, use, amount) { |
100 var result; |
102 var result; |
101 |
103 |
102 if ((use == "First Wort") || (use == "First wort")) { |
104 if ((use == "First Wort") || (use == "First wort")) { |
103 result = 0.15 * amount * 1000; // assume 15% flavourcontribution for fwh |
105 result = 0.15; // assume 15% flavourcontribution for fwh |
104 } else if (bt > 50) { |
106 } else if (bt > 50) { |
105 result = 0.10 * amount * 1000; // assume 10% flavourcontribution as a minimum |
107 result = 0.10; // assume 10% flavourcontribution as a minimum |
106 } else { |
108 } else { |
107 result = 15.25 / (6 * Math.sqrt(2 * Math.PI)) * Math.exp(-0.5 * Math.pow((bt - 21) /6, 2)) * amount * 1000; |
109 result = 15.25 / (6 * Math.sqrt(2 * Math.PI)) * Math.exp(-0.5 * Math.pow((bt - 21) /6, 2)); |
108 if (result < (0.10 * amount * 1000)) |
110 if (result < 0.10) |
109 result = 0.10 * amount * 1000; // assume 10% flavourcontribution as a minimum |
111 result = 0.10; // assume 10% flavourcontribution as a minimum |
110 } |
112 } |
111 console.log("hopFlavourContribution("+bt+","+vol+","+use+","+amount+"): "+(result / vol)); |
113 result = (result * amount * 1000) / vol; |
112 return result / vol; |
114 // console.log("hopFlavourContribution("+bt+","+vol+","+use+","+amount+"): "+result); |
|
115 return result; |
113 } |
116 } |
114 |
117 |
115 function hopAromaContribution(bt, vol, use, amount) { |
118 function hopAromaContribution(bt, vol, use, amount) { |
116 var result = 0; |
119 var result = 0; |
117 |
120 |
118 if (bt > 20) { |
121 if (bt > 20) { |
119 result = 0; |
122 result = 0; |
120 } else if (bt > 7.5) { |
123 } else if (bt > 7.5) { |
121 result = 10.03 / (4 * Math.sqrt(2 * Math.PI)) * Math.exp(-0.5 * Math.pow((bt - 7.5) /4, 2)) * amount * 1000; |
124 result = 10.03 / (4 * Math.sqrt(2 * Math.PI)) * Math.exp(-0.5 * Math.pow((bt - 7.5) /4, 2)); |
122 } else if (use == "Boil") { |
125 } else if (use == "Boil") { |
123 result = amount * 1000; |
126 result = 1; |
124 } else if (use == "Aroma") { |
127 } else if (use == "Aroma") { |
125 result = 1.2 * amount * 1000; |
128 result = 1.2; |
126 } else if (use == "Whirlpool") { |
129 } else if (use == "Whirlpool") { |
127 result = 1.2 * amount * 1000; |
130 result = 1.2; |
128 } else if ((use == "Dry Hop") || (use == "Dry hop")) { |
131 } else if ((use == "Dry Hop") || (use == "Dry hop")) { |
129 result = 1.33 * amount * 1000; |
132 result = 1.33; |
130 } |
133 } |
131 console.log("hopAromaContribution("+bt+","+vol+","+use+","+amount+"): "+(result / vol)); |
134 result = (result * amount * 1000) / vol; |
132 return result / vol; |
135 // console.log("hopAromaContribution("+bt+","+vol+","+use+","+amount+"): "+result); |
|
136 return result; |
133 } |
137 } |
134 |
138 |
135 function calcIBUs() { |
139 function calcIBUs() { |
136 var total_ibus = 0; |
140 var total_ibus = 0; |
|
141 hop_aroma = hop_flavour = 0; |
137 var rows = $('#hopGrid').jqxGrid('getrows'); |
142 var rows = $('#hopGrid').jqxGrid('getrows'); |
138 for (var i = 0; i < rows.length; i++) { |
143 for (var i = 0; i < rows.length; i++) { |
139 var row = rows[i]; |
144 var row = rows[i]; |
140 total_ibus += toIBU(row.h_useat, row.h_form, preboil_sg, parseFloat($("#batch_size").jqxNumberInput('decimal')), |
145 total_ibus += toIBU(row.h_useat, row.h_form, preboil_sg, parseFloat($("#batch_size").jqxNumberInput('decimal')), |
141 parseFloat(row.h_amount), parseFloat(row.h_time), parseFloat(row.h_alpha), $("#ibu_method").val()); |
146 parseFloat(row.h_amount), parseFloat(row.h_time), parseFloat(row.h_alpha), $("#ibu_method").val()); |
142 hopFlavourContribution(parseFloat(row.h_time), parseFloat($("#batch_size").jqxNumberInput('decimal')), |
147 hop_flavour += hopFlavourContribution(parseFloat(row.h_time), parseFloat($("#batch_size").jqxNumberInput('decimal')), |
143 row.h_useat, parseFloat(row.h_amount)); |
148 row.h_useat, parseFloat(row.h_amount)); |
144 hopAromaContribution(parseFloat(row.h_time), parseFloat($("#batch_size").jqxNumberInput('decimal')), |
149 hop_aroma += hopAromaContribution(parseFloat(row.h_time), parseFloat($("#batch_size").jqxNumberInput('decimal')), |
145 row.h_useat, parseFloat(row.h_amount)); |
150 row.h_useat, parseFloat(row.h_amount)); |
146 } |
151 } |
147 total_ibus = Math.round(total_ibus); |
152 total_ibus = Math.round(total_ibus); |
148 console.log("calcIBUs(): " + total_ibus); |
153 console.log("calcIBUs(): " + total_ibus + " flavour: " + hop_flavour + " aroma: " + hop_aroma); |
149 dataRecord.est_ibu = total_ibus; |
154 dataRecord.est_ibu = total_ibus; |
150 $('#est_ibu').val(total_ibus); |
155 $('#est_ibu').val(total_ibus); |
|
156 $('#est_ibu2').val(total_ibus); |
151 }; |
157 }; |
152 |
158 |
153 function calcSVG() { |
159 function calcSVG() { |
154 var rows = $('#yeastGrid').jqxGrid('getrows'); |
160 var rows = $('#yeastGrid').jqxGrid('getrows'); |
155 for (var i = 0; i < rows.length; i++) { |
161 for (var i = 0; i < rows.length; i++) { |
330 $("#efficiency").jqxTooltip({ content: 'Het rendement van maischen en koken.' }); |
336 $("#efficiency").jqxTooltip({ content: 'Het rendement van maischen en koken.' }); |
331 $("#est_og").jqxTooltip({ content: 'Het begin SG wat je wilt bereiken. De moutstort wordt automatisch herberekend.' }); |
337 $("#est_og").jqxTooltip({ content: 'Het begin SG wat je wilt bereiken. De moutstort wordt automatisch herberekend.' }); |
332 $("#est_fg").jqxTooltip({ content: 'Het eind SG. Dit wordt automatisch berekend.' }); |
338 $("#est_fg").jqxTooltip({ content: 'Het eind SG. Dit wordt automatisch berekend.' }); |
333 $("#est_color").jqxTooltip({ content: 'De kleur in EBC. Dit wordt automatisch berekend.' }); |
339 $("#est_color").jqxTooltip({ content: 'De kleur in EBC. Dit wordt automatisch berekend.' }); |
334 $("#est_ibu").jqxTooltip({ content: 'De bitterheid in IBU. Dit wordt automatisch berekend.' }); |
340 $("#est_ibu").jqxTooltip({ content: 'De bitterheid in IBU. Dit wordt automatisch berekend.' }); |
|
341 $("#est_ibu2").jqxTooltip({ content: 'De bitterheid in IBU. Dit wordt automatisch berekend.' }); |
335 $("#est_abv").jqxTooltip({ content: 'Alcohol volume %. Dit wordt automatisch berekend.' }); |
342 $("#est_abv").jqxTooltip({ content: 'Alcohol volume %. Dit wordt automatisch berekend.' }); |
336 $("#est_carb").jqxTooltip({ content: 'Koolzuur volume. Dit wordt automatisch berekend.' }); |
343 $("#est_carb").jqxTooltip({ content: 'Koolzuur volume. Dit wordt automatisch berekend.' }); |
337 |
344 |
338 $("#st_name").jqxTooltip({ content: 'De bierstijl naam voor dit recept.'}); |
345 $("#st_name").jqxTooltip({ content: 'De bierstijl naam voor dit recept.'}); |
339 $("#st_letter").jqxTooltip({ content: 'De bierstijl letter voor dit recept.'}); |
346 $("#st_letter").jqxTooltip({ content: 'De bierstijl letter voor dit recept.'}); |
436 $("#st_abv_max").val(dataRecord.st_abv_max); |
443 $("#st_abv_max").val(dataRecord.st_abv_max); |
437 $("#st_color_min").val(dataRecord.st_color_min); |
444 $("#st_color_min").val(dataRecord.st_color_min); |
438 $("#st_color_max").val(dataRecord.st_color_max); |
445 $("#st_color_max").val(dataRecord.st_color_max); |
439 $("#color_method").val(dataRecord.color_method); |
446 $("#color_method").val(dataRecord.color_method); |
440 $("#est_ibu").val(dataRecord.est_ibu); |
447 $("#est_ibu").val(dataRecord.est_ibu); |
|
448 $("#est_ibu2").val(dataRecord.est_ibu); |
441 $("#st_ibu_min").val(dataRecord.st_ibu_min); |
449 $("#st_ibu_min").val(dataRecord.st_ibu_min); |
442 $("#st_ibu_max").val(dataRecord.st_ibu_max); |
450 $("#st_ibu_max").val(dataRecord.st_ibu_max); |
443 $("#ibu_method").val(dataRecord.ibu_method); |
451 $("#ibu_method").val(dataRecord.ibu_method); |
444 $("#est_carb").val(dataRecord.est_carb); |
452 $("#est_carb").val(dataRecord.est_carb); |
445 $("#st_carb_min").val(dataRecord.st_carb_min); |
453 $("#st_carb_min").val(dataRecord.st_carb_min); |
1550 $("#st_color_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); |
1558 $("#st_color_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); |
1551 $("#st_color_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); |
1559 $("#st_color_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); |
1552 $("#color_method").jqxDropDownList({ theme: theme, source: srcColor, width: 125, height: 23, dropDownHeight: 95 }); |
1560 $("#color_method").jqxDropDownList({ theme: theme, source: srcColor, width: 125, height: 23, dropDownHeight: 95 }); |
1553 |
1561 |
1554 $("#est_ibu").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); |
1562 $("#est_ibu").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); |
|
1563 $("#est_ibu2").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); |
1555 $("#st_ibu_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); |
1564 $("#st_ibu_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); |
1556 $("#st_ibu_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); |
1565 $("#st_ibu_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); |
1557 $("#ibu_method").jqxDropDownList({ theme: theme, source: srcIBU, width: 125, height: 23, dropDownHeight: 95, dropDownVerticalAlignment: 'top' }); |
1566 $("#ibu_method").jqxDropDownList({ theme: theme, source: srcIBU, width: 125, height: 23, dropDownHeight: 95, dropDownVerticalAlignment: 'top' }); |
1558 |
1567 |
1559 $("#est_carb").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); |
1568 $("#est_carb").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); |
1561 $("#st_carb_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); |
1570 $("#st_carb_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); |
1562 |
1571 |
1563 $("#mash_name").jqxInput({ theme: theme, width: 320, height: 23 }); |
1572 $("#mash_name").jqxInput({ theme: theme, width: 320, height: 23 }); |
1564 $("#mash_ph").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 4, max: 8, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1 }); |
1573 $("#mash_ph").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 4, max: 8, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1 }); |
1565 $("#mash_sparge_temp").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 70, max: 98, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.5 }); |
1574 $("#mash_sparge_temp").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 70, max: 98, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.5 }); |
|
1575 // Hop flavour and aroma gauges |
1566 |
1576 |
1567 // Tabs inside the popup window. |
1577 // Tabs inside the popup window. |
1568 $('#jqxTabs').jqxTabs({ |
1578 $('#jqxTabs').jqxTabs({ |
1569 theme: theme, |
1579 theme: theme, |
1570 width: 1280, |
1580 width: 1280, |