Sat, 17 Nov 2018 20:40:23 +0100
IBU calculations now use the setup values. All setup values are now global available.
13 | 1 | /***************************************************************************** |
2 | * Copyright (C) 2014 | |
3 | * | |
4 | * Michiel Broek <mbroek at mbse dot eu> | |
5 | * | |
6 | * This file is part of BrewCloud | |
7 | * | |
8 | * This is free software; you can redistribute it and/or modify it | |
9 | * under the terms of the GNU General Public License as published by the | |
10 | * Free Software Foundation; either version 2, or (at your option) any | |
11 | * later version. | |
12 | * | |
13 | * BrewCloud is distributed in the hope that it will be useful, but | |
14 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
16 | * General Public License for more details. | |
17 | * | |
18 | * You should have received a copy of the GNU General Public License | |
19 | * along with ThermFerm; see the file COPYING. If not, write to the Free | |
20 | * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. | |
21 | *****************************************************************************/ | |
22 | ||
23 | ||
24 | function getLocalization() { | |
25 | var localizationobj = {}; | |
26 | localizationobj.pagerGoToPageString = "Gehe zu:"; | |
27 | localizationobj.pagerShowRowsString = "Zeige Zeile:"; | |
28 | localizationobj.pagerRangeString = " von "; | |
29 | localizationobj.pagerNextButtonString = "voriger"; | |
30 | localizationobj.pagerFirstButtonString = "first"; | |
31 | localizationobj.pagerLastButtonString = "last"; | |
32 | localizationobj.pagerPreviousButtonString = "nächster"; | |
33 | localizationobj.sortAscendingString = "Sortiere aufsteigend"; | |
34 | localizationobj.sortDescendingString = "Sortiere absteigend"; | |
35 | localizationobj.sortRemoveString = "Entferne Sortierung"; | |
36 | localizationobj.firstDay = 1; | |
37 | localizationobj.percentSymbol = "%"; | |
38 | localizationobj.currencySymbol = "€"; | |
39 | localizationobj.currencySymbolPosition = "after"; | |
40 | localizationobj.decimalSeparator = ","; | |
41 | localizationobj.thousandsSeparator = "."; | |
42 | var days = { | |
43 | // full day names | |
44 | names: ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"], | |
45 | // abbreviated day names | |
46 | namesAbbr: ["Sonn", "Mon", "Dien", "Mitt", "Donn", "Fre", "Sams"], | |
47 | // shortest day names | |
48 | namesShort: ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"] | |
49 | }; | |
50 | localizationobj.days = days; | |
51 | var months = { | |
52 | // full month names (13 months for lunar calendards -- 13th month should be "" if not lunar) | |
53 | names: ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember", ""], | |
54 | // abbreviated month names | |
55 | namesAbbr: ["Jan", "Feb", "Mär", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dez", ""] | |
56 | }; | |
57 | var patterns = { | |
58 | d: "dd.MM.yyyy", | |
59 | D: "dddd, d. MMMM yyyy", | |
60 | t: "HH:mm", | |
61 | T: "HH:mm:ss", | |
62 | f: "dddd, d. MMMM yyyy HH:mm", | |
63 | F: "dddd, d. MMMM yyyy HH:mm:ss", | |
64 | M: "dd MMMM", | |
65 | Y: "MMMM yyyy" | |
66 | } | |
67 | localizationobj.patterns = patterns; | |
68 | localizationobj.months = months; | |
69 | return localizationobj; | |
70 | } | |
71 | ||
72 | ||
73 | ||
74 | $(document).ready(function () { | |
34 | 75 | |
13 | 76 | $("#jqxMenu").jqxMenu({ |
77 | width: 1280, | |
78 | height: '30px', | |
79 | theme: theme | |
80 | }); | |
81 | $("#jqxWidget").css('visibility', 'visible'); | |
82 | }); | |
83 | ||
59
ad28e09e3abd
Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents:
34
diff
changeset
|
84 | |
ad28e09e3abd
Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents:
34
diff
changeset
|
85 | |
98
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
86 | function ebc_to_srm(ebc) { |
100
08c92cb740b9
Fix for missing coor info on fermentables during recipes import. Log when srm or ebc values are negatie during conversions. Load setup record in global.inc.php and make some variables available for PHP and JS.
Michiel Broek <mbroek@mbse.eu>
parents:
98
diff
changeset
|
87 | var srm = -1.32303E-12 * Math.pow(ebc, 4) - 0.00000000291515 * Math.pow(ebc, 3) + 0.00000818515 * Math.pow(ebc, 2) + 0.372038 * ebc + 0.596351; |
08c92cb740b9
Fix for missing coor info on fermentables during recipes import. Log when srm or ebc values are negatie during conversions. Load setup record in global.inc.php and make some variables available for PHP and JS.
Michiel Broek <mbroek@mbse.eu>
parents:
98
diff
changeset
|
88 | if ((ebc < 0) || (srm < 0)) |
08c92cb740b9
Fix for missing coor info on fermentables during recipes import. Log when srm or ebc values are negatie during conversions. Load setup record in global.inc.php and make some variables available for PHP and JS.
Michiel Broek <mbroek@mbse.eu>
parents:
98
diff
changeset
|
89 | console.log("ebc_to_srm("+ebc+") = "+srm); |
08c92cb740b9
Fix for missing coor info on fermentables during recipes import. Log when srm or ebc values are negatie during conversions. Load setup record in global.inc.php and make some variables available for PHP and JS.
Michiel Broek <mbroek@mbse.eu>
parents:
98
diff
changeset
|
90 | return srm |
98
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
91 | } |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
92 | |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
93 | |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
94 | |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
95 | function srm_to_ebc(srm) |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
96 | { |
100
08c92cb740b9
Fix for missing coor info on fermentables during recipes import. Log when srm or ebc values are negatie during conversions. Load setup record in global.inc.php and make some variables available for PHP and JS.
Michiel Broek <mbroek@mbse.eu>
parents:
98
diff
changeset
|
97 | var ebc = Math.round(0.000000000176506 * Math.pow(srm, 4) + 0.000000154529 * Math.pow(srm, 3) - 0.000159428 * Math.pow(srm, 2) + 2.68837 * srm - 1.6004); |
08c92cb740b9
Fix for missing coor info on fermentables during recipes import. Log when srm or ebc values are negatie during conversions. Load setup record in global.inc.php and make some variables available for PHP and JS.
Michiel Broek <mbroek@mbse.eu>
parents:
98
diff
changeset
|
98 | if ((ebc < 0) || (srm < 0)) |
08c92cb740b9
Fix for missing coor info on fermentables during recipes import. Log when srm or ebc values are negatie during conversions. Load setup record in global.inc.php and make some variables available for PHP and JS.
Michiel Broek <mbroek@mbse.eu>
parents:
98
diff
changeset
|
99 | console.log("srm_to_ebc("+srm+") = "+ebc); |
08c92cb740b9
Fix for missing coor info on fermentables during recipes import. Log when srm or ebc values are negatie during conversions. Load setup record in global.inc.php and make some variables available for PHP and JS.
Michiel Broek <mbroek@mbse.eu>
parents:
98
diff
changeset
|
100 | return ebc; |
98
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
101 | } |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
102 | |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
103 | |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
104 | |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
105 | /* |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
106 | * Kleurwerking naar SRM |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
107 | */ |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
108 | function kw_to_srm(colormethod, c) { |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
109 | |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
110 | if (colormethod == "Morey") |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
111 | return 1.4922 * Math.pow(c, 0.6859); |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
112 | if (colormethod == "Mosher") |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
113 | return 0.3 * c + 4.7; |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
114 | if (colormethod == "Daniels") |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
115 | return 0.2 * c + 8.4; |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
116 | } |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
117 | |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
118 | |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
119 | |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
120 | function kw_to_ebc(colormethod, c) { |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
121 | return srm_to_ebc(kw_to_srm(colormethod, c)); |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
122 | } |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
123 | |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
124 | |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
125 | |
59
ad28e09e3abd
Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents:
34
diff
changeset
|
126 | /* |
ad28e09e3abd
Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents:
34
diff
changeset
|
127 | * Berekeningen uit https://www.hobbybrouwen.nl/forum/index.php/topic,6079.msg69464.html#msg69464 |
ad28e09e3abd
Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents:
34
diff
changeset
|
128 | */ |
101
5b6bb99bc52a
IBU calculations now use the setup values. All setup values are now global available.
Michiel Broek <mbroek@mbse.eu>
parents:
100
diff
changeset
|
129 | function toIBU(Use, Form, SG, Volume, Amount, Boiltime, Alpha, Method) |
5b6bb99bc52a
IBU calculations now use the setup values. All setup values are now global available.
Michiel Broek <mbroek@mbse.eu>
parents:
100
diff
changeset
|
130 | { |
59
ad28e09e3abd
Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents:
34
diff
changeset
|
131 | var gravity = parseFloat(SG); |
ad28e09e3abd
Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents:
34
diff
changeset
|
132 | var liters = parseFloat(Volume); |
ad28e09e3abd
Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents:
34
diff
changeset
|
133 | var alpha = parseFloat(Alpha)/100; |
ad28e09e3abd
Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents:
34
diff
changeset
|
134 | var mass = parseFloat(Amount) * 1000; |
ad28e09e3abd
Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents:
34
diff
changeset
|
135 | var time = parseFloat(Boiltime); |
ad28e09e3abd
Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents:
34
diff
changeset
|
136 | var fmoment = 1.0; |
ad28e09e3abd
Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents:
34
diff
changeset
|
137 | var pfactor = 1.0; |
92
fab98e5c86fc
Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents:
70
diff
changeset
|
138 | var ibu = 0; |
59
ad28e09e3abd
Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents:
34
diff
changeset
|
139 | |
92
fab98e5c86fc
Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents:
70
diff
changeset
|
140 | if ((Use == "Dry Hop") || (Use == "Dry hop") || (Use == "Whirlpool") || (Use == "Aroma")) { |
59
ad28e09e3abd
Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents:
34
diff
changeset
|
141 | fmoment = 0.0; |
ad28e09e3abd
Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents:
34
diff
changeset
|
142 | } else if (Use == "Mash") { |
101
5b6bb99bc52a
IBU calculations now use the setup values. All setup values are now global available.
Michiel Broek <mbroek@mbse.eu>
parents:
100
diff
changeset
|
143 | fmoment += my_factor_mashhop / 100; // Brouwhulp |
59
ad28e09e3abd
Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents:
34
diff
changeset
|
144 | } else if ((Use == "First Wort") || (Use == "First wort")) { |
101
5b6bb99bc52a
IBU calculations now use the setup values. All setup values are now global available.
Michiel Broek <mbroek@mbse.eu>
parents:
100
diff
changeset
|
145 | fmoment += my_factor_fwh / 100; // Brouwhulp, Louis, Ozzie |
59
ad28e09e3abd
Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents:
34
diff
changeset
|
146 | } |
ad28e09e3abd
Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents:
34
diff
changeset
|
147 | |
ad28e09e3abd
Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents:
34
diff
changeset
|
148 | if (Form == "Pellet") { |
101
5b6bb99bc52a
IBU calculations now use the setup values. All setup values are now global available.
Michiel Broek <mbroek@mbse.eu>
parents:
100
diff
changeset
|
149 | pfactor += my_factor_pellet / 100; |
92
fab98e5c86fc
Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents:
70
diff
changeset
|
150 | } |
fab98e5c86fc
Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents:
70
diff
changeset
|
151 | if (Form == "Plug" ) { |
101
5b6bb99bc52a
IBU calculations now use the setup values. All setup values are now global available.
Michiel Broek <mbroek@mbse.eu>
parents:
100
diff
changeset
|
152 | pfactor += my_factor_plug / 100; |
59
ad28e09e3abd
Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents:
34
diff
changeset
|
153 | } |
ad28e09e3abd
Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents:
34
diff
changeset
|
154 | |
92
fab98e5c86fc
Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents:
70
diff
changeset
|
155 | if (Method == "Tinseth") { |
98
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
156 | /* http://realbeer.com/hops/research.html */ |
92
fab98e5c86fc
Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents:
70
diff
changeset
|
157 | var AddedAlphaAcids = (alpha * mass * 1000) / liters; |
fab98e5c86fc
Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents:
70
diff
changeset
|
158 | var Bigness_factor = 1.65 * Math.pow( 0.000125, gravity - 1); |
98
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
159 | var BoilTime_factor = ((1 - Math.exp(-0.04 * time)) / 4.15); |
92
fab98e5c86fc
Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents:
70
diff
changeset
|
160 | var utiisation = Bigness_factor * BoilTime_factor; |
fab98e5c86fc
Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents:
70
diff
changeset
|
161 | ibu = Math.round(utiisation * AddedAlphaAcids * fmoment * pfactor * 10) / 10.0; |
fab98e5c86fc
Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents:
70
diff
changeset
|
162 | } |
fab98e5c86fc
Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents:
70
diff
changeset
|
163 | if (Method == "Daniels") { |
fab98e5c86fc
Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents:
70
diff
changeset
|
164 | var boilfactor; |
fab98e5c86fc
Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents:
70
diff
changeset
|
165 | var sgfactor; |
fab98e5c86fc
Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents:
70
diff
changeset
|
166 | if (Form == "Leaf") |
fab98e5c86fc
Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents:
70
diff
changeset
|
167 | boilfactor = -(0.0041*time*time)+(0.6162*time)+1.5779; |
fab98e5c86fc
Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents:
70
diff
changeset
|
168 | else |
fab98e5c86fc
Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents:
70
diff
changeset
|
169 | boilfactor = -(0.0051*time*time)+(0.7835*time)+1.9348; |
fab98e5c86fc
Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents:
70
diff
changeset
|
170 | if (gravity < 1050) |
fab98e5c86fc
Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents:
70
diff
changeset
|
171 | sgfactor = 0; |
fab98e5c86fc
Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents:
70
diff
changeset
|
172 | else |
fab98e5c86fc
Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents:
70
diff
changeset
|
173 | sgfactor = (gravity - 1050) / 200; |
fab98e5c86fc
Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents:
70
diff
changeset
|
174 | ibu = Math.round(fmoment * ((mass * (alpha * 100) * boilfactor * 0.1) / (liters * (1 + sgfactor))) * 10) / 10; |
fab98e5c86fc
Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents:
70
diff
changeset
|
175 | } |
fab98e5c86fc
Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents:
70
diff
changeset
|
176 | if (Method == "Rager") { |
fab98e5c86fc
Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents:
70
diff
changeset
|
177 | var boilfactor; |
fab98e5c86fc
Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents:
70
diff
changeset
|
178 | var sgfactor; |
fab98e5c86fc
Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents:
70
diff
changeset
|
179 | boilfactor = fmoment * 18.11 + 13.86 * Math.tanh((time * 31.32) / 18.27); |
fab98e5c86fc
Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents:
70
diff
changeset
|
180 | if (gravity < 1050) |
fab98e5c86fc
Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents:
70
diff
changeset
|
181 | sgfactor = 0; |
fab98e5c86fc
Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents:
70
diff
changeset
|
182 | else |
fab98e5c86fc
Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents:
70
diff
changeset
|
183 | sgfactor = (gravity - 1050) / 200; |
fab98e5c86fc
Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents:
70
diff
changeset
|
184 | ibu = Math.round((mass * (alpha * 100) * boilfactor * 0.1) / (liters * (1 + sgfactor)) * 10) / 10; |
fab98e5c86fc
Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents:
70
diff
changeset
|
185 | } |
59
ad28e09e3abd
Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents:
34
diff
changeset
|
186 | |
101
5b6bb99bc52a
IBU calculations now use the setup values. All setup values are now global available.
Michiel Broek <mbroek@mbse.eu>
parents:
100
diff
changeset
|
187 | console.log("toIBU("+Use+","+Form+","+SG+","+Volume+","+Amount+","+Boiltime+","+Alpha+","+Method+"):"+ibu+" fm:"+fmoment+" pf:"+pfactor); |
59
ad28e09e3abd
Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents:
34
diff
changeset
|
188 | return ibu; |
ad28e09e3abd
Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents:
34
diff
changeset
|
189 | } |
ad28e09e3abd
Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents:
34
diff
changeset
|
190 | |
ad28e09e3abd
Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents:
34
diff
changeset
|
191 | |
ad28e09e3abd
Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents:
34
diff
changeset
|
192 | |
96
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
94
diff
changeset
|
193 | function sg_to_plato(sg) { |
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
94
diff
changeset
|
194 | if (sg > 0.5) |
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
94
diff
changeset
|
195 | return 259 - 259 / sg; |
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
94
diff
changeset
|
196 | return 0; |
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
94
diff
changeset
|
197 | } |
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
94
diff
changeset
|
198 | |
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
94
diff
changeset
|
199 | |
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
94
diff
changeset
|
200 | |
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
94
diff
changeset
|
201 | function plato_to_sg(plato) { |
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
94
diff
changeset
|
202 | if (plato < 259) |
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
94
diff
changeset
|
203 | return 259 / (259 - plato); |
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
94
diff
changeset
|
204 | return 1.000; |
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
94
diff
changeset
|
205 | } |
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
94
diff
changeset
|
206 | |
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
94
diff
changeset
|
207 | |
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
94
diff
changeset
|
208 | |
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
94
diff
changeset
|
209 | function estimate_sg(sugars, batch_size) { |
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
94
diff
changeset
|
210 | var plato = 100 * sugars / batch_size; |
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
94
diff
changeset
|
211 | |
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
94
diff
changeset
|
212 | var sg = plato_to_sg(plato); |
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
94
diff
changeset
|
213 | for (var i = 0; i < 20; i++) { |
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
94
diff
changeset
|
214 | if (sg > 0) |
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
94
diff
changeset
|
215 | plato = 100 * sugars / (batch_size * sg); |
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
94
diff
changeset
|
216 | sg = plato_to_sg(plato); |
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
94
diff
changeset
|
217 | } |
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
94
diff
changeset
|
218 | console.log("estimate_sg(" + sugars + "," + batch_size + ") : " + sg); |
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
94
diff
changeset
|
219 | return sg; |
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
94
diff
changeset
|
220 | } |
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
94
diff
changeset
|
221 | |
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
94
diff
changeset
|
222 | |
70
4da2414eabbc
Jqwidgets upgraded to version 6.0.6
Michiel Broek <mbroek@mbse.eu>
parents:
67
diff
changeset
|
223 | /* |
4da2414eabbc
Jqwidgets upgraded to version 6.0.6
Michiel Broek <mbroek@mbse.eu>
parents:
67
diff
changeset
|
224 | * Steinie: |
4da2414eabbc
Jqwidgets upgraded to version 6.0.6
Michiel Broek <mbroek@mbse.eu>
parents:
67
diff
changeset
|
225 | * |
4da2414eabbc
Jqwidgets upgraded to version 6.0.6
Michiel Broek <mbroek@mbse.eu>
parents:
67
diff
changeset
|
226 | * |
4da2414eabbc
Jqwidgets upgraded to version 6.0.6
Michiel Broek <mbroek@mbse.eu>
parents:
67
diff
changeset
|
227 | * HCO3 = CaCo3 x 1,22 |
4da2414eabbc
Jqwidgets upgraded to version 6.0.6
Michiel Broek <mbroek@mbse.eu>
parents:
67
diff
changeset
|
228 | * 1°F = 10mg/L CaCo3 |
4da2414eabbc
Jqwidgets upgraded to version 6.0.6
Michiel Broek <mbroek@mbse.eu>
parents:
67
diff
changeset
|
229 | */ |
59
ad28e09e3abd
Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents:
34
diff
changeset
|
230 |