Wed, 14 Nov 2018 16:49:56 +0100
Added Rager and Daniels IBU calculations to javascript formula.
/***************************************************************************** * Copyright (C) 2014 * * Michiel Broek <mbroek at mbse dot eu> * * This file is part of BrewCloud * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2, or (at your option) any * later version. * * BrewCloud is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with ThermFerm; see the file COPYING. If not, write to the Free * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *****************************************************************************/ function getLocalization() { var localizationobj = {}; localizationobj.pagerGoToPageString = "Gehe zu:"; localizationobj.pagerShowRowsString = "Zeige Zeile:"; localizationobj.pagerRangeString = " von "; localizationobj.pagerNextButtonString = "voriger"; localizationobj.pagerFirstButtonString = "first"; localizationobj.pagerLastButtonString = "last"; localizationobj.pagerPreviousButtonString = "nächster"; localizationobj.sortAscendingString = "Sortiere aufsteigend"; localizationobj.sortDescendingString = "Sortiere absteigend"; localizationobj.sortRemoveString = "Entferne Sortierung"; localizationobj.firstDay = 1; localizationobj.percentSymbol = "%"; localizationobj.currencySymbol = "€"; localizationobj.currencySymbolPosition = "after"; localizationobj.decimalSeparator = ","; localizationobj.thousandsSeparator = "."; var days = { // full day names names: ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"], // abbreviated day names namesAbbr: ["Sonn", "Mon", "Dien", "Mitt", "Donn", "Fre", "Sams"], // shortest day names namesShort: ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"] }; localizationobj.days = days; var months = { // full month names (13 months for lunar calendards -- 13th month should be "" if not lunar) names: ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember", ""], // abbreviated month names namesAbbr: ["Jan", "Feb", "Mär", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dez", ""] }; var patterns = { d: "dd.MM.yyyy", D: "dddd, d. MMMM yyyy", t: "HH:mm", T: "HH:mm:ss", f: "dddd, d. MMMM yyyy HH:mm", F: "dddd, d. MMMM yyyy HH:mm:ss", M: "dd MMMM", Y: "MMMM yyyy" } localizationobj.patterns = patterns; localizationobj.months = months; return localizationobj; } $(document).ready(function () { $("#jqxMenu").jqxMenu({ width: 1280, height: '30px', theme: theme }); $("#jqxWidget").css('visibility', 'visible'); }); /* * Berekeningen uit https://www.hobbybrouwen.nl/forum/index.php/topic,6079.msg69464.html#msg69464 */ function toIBU(Use, Form, SG, Volume, Amount, Boiltime, Alpha, Method) { var gravity = parseFloat(SG); var liters = parseFloat(Volume); var alpha = parseFloat(Alpha)/100; var mass = parseFloat(Amount) * 1000; var time = parseFloat(Boiltime); var fmoment = 1.0; var pfactor = 1.0; var ibu = 0; console.log("toIBU_Tinseth("+Use+"," + Form + "," + SG + "," + Volume + "," + Amount + "," + Boiltime + "," + Alpha + "," + Method + ")"); if ((Use == "Dry Hop") || (Use == "Dry hop") || (Use == "Whirlpool") || (Use == "Aroma")) { fmoment = 0.0; } else if (Use == "Mash") { fmoment += /* Settings.MashHopFactor.Value = -30% */ -30 / 100; // Brouwhulp } else if ((Use == "First Wort") || (Use == "First wort")) { fmoment += /* Settings.FWHFactor.Value = 10% */ 10 / 100; // Brouwhulp, Louis, Ozzie } if (Form == "Pellet") { pfactor += /* Settings.PelletFactor.Value = 10% */ 10 / 100; } if (Form == "Plug" ) { pfactor += /* Settings.PlugFactor.Value = 2% */ 2 / 100; } // TODO: sg = (postBoilGravity - 1.0) * batchSize / boilSize; if (Method == "Tinseth") { /* * http://realbeer.com/hops/research.html * * decimal AA rating * grams hops * 1000 * mg/l of added alpha acids = ------------------------------------- * volume of finished beer in liters * * Bigness factor = 1.65 * 0.000125^(wort gravity - 1) * * 1 - e^(-0.04 * time in mins) * Boil Time factor = ---------------------------- * 4.15 * * decimal alpha acid utilization = Bigness factor * Boil Time factor * * IBUs = decimal alpha acid utilization * mg/l of added alpha acids */ var AddedAlphaAcids = (alpha * mass * 1000) / liters; var Bigness_factor = 1.65 * Math.pow( 0.000125, gravity - 1); var BoilTime_factor = ((1 - Math.exp(-0.04 * time)) / 4.15); // Glen Tinseth var utiisation = Bigness_factor * BoilTime_factor; console.log(" AddedAlphaAcids:"+AddedAlphaAcids+" Bigness_factor:"+Bigness_factor+" BoilTime_factor:"+BoilTime_factor+" utilisation:"+utiisation); ibu = Math.round(utiisation * AddedAlphaAcids * fmoment * pfactor * 10) / 10.0; } if (Method == "Daniels") { var boilfactor; var sgfactor; if (Form == "Leaf") boilfactor = -(0.0041*time*time)+(0.6162*time)+1.5779; else boilfactor = -(0.0051*time*time)+(0.7835*time)+1.9348; if (gravity < 1050) sgfactor = 0; else sgfactor = (gravity - 1050) / 200; ibu = Math.round(fmoment * ((mass * (alpha * 100) * boilfactor * 0.1) / (liters * (1 + sgfactor))) * 10) / 10; } if (Method == "Rager") { var boilfactor; var sgfactor; boilfactor = fmoment * 18.11 + 13.86 * Math.tanh((time * 31.32) / 18.27); if (gravity < 1050) sgfactor = 0; else sgfactor = (gravity - 1050) / 200; ibu = Math.round((mass * (alpha * 100) * boilfactor * 0.1) / (liters * (1 + sgfactor)) * 10) / 10; } console.log(" fmoment:"+fmoment+" pfactor:"+pfactor+" IBU:"+ibu); return ibu; } /* * Steinie: * * * HCO3 = CaCo3 x 1,22 * 1°F = 10mg/L CaCo3 */