# HG changeset patch # User Michiel Broek # Date 1560611947 -7200 # Node ID cbeec46450f86c36dea920bcf14bfb5561164eae # Parent def3900207ccd0af0be78241fd02214632b380b4 Changed residuential co2 calculation to the more modern one. Added calculation of maximum bottle pressure during bottle priming. diff -r def3900207cc -r cbeec46450f8 README.design --- a/README.design Fri Jun 14 20:22:16 2019 +0200 +++ b/README.design Sat Jun 15 17:19:07 2019 +0200 @@ -18,22 +18,3 @@ Popups in de editors met rekenhulpjes. -Koolzuurdruk tabel inbouwen. - -Bottelsuiker: - -x select name,type,yield,moisture from inventory_fermentables where type = 1 or type = 3; - -x Dit geeft de suikers en droge malt extracten. Hieruit is ook de opbrengst te berekenen - om de juiste hoeveelheid te bepalen. -x De PrimingSugarSource kan vervallen zodra alle bottelsuikers in de database verwerkt - zijn. -x Hiervoor een script maken om deze suikers als fermentable in het recept te zetten - met 'added = 4'. -x Toevoegen added = 5, voor kegs. -x In products vervallen de velden bottle_priming_sugar en keg_priming_sugar. -x Deze waardes komen uit fermentables. -x Let op, de amount waardes zijn g/l dus omrekenen. -x Ook aanpassen de recept suikerstort, de added 4 of 5 niet meenemen. - - diff -r def3900207cc -r cbeec46450f8 www/js/prod_edit.js --- a/www/js/prod_edit.js Fri Jun 14 20:22:16 2019 +0200 +++ b/www/js/prod_edit.js Sat Jun 15 17:19:07 2019 +0200 @@ -1787,14 +1787,36 @@ } } + function ResCO2(CO2, T) { + //var resco2 = 0.000849151 * T * T - 0.0587512 * T + 1.71137; // brouwhulp + var F = T * 1.8 + 32; + var resco2 = 3.0378 - 0.050062 * F + 0.00026555 * F * F; // most of the rest + //console.log("CO2: "+resco2); + return resco2; + } + function CarbCO2toS(CO2, T, SFactor) { - // Calculation of disolved CO2 in the beer, brouwhulp. - var sugar = SFactor * (CO2 - (0.000849151 * T * T - 0.0587512 * T + 1.71137)) / 0.286; + var sugar = SFactor * (CO2 - ResCO2(CO2, T)) / 0.286; if (sugar < 0) sugar = 0; return Math.round(sugar * 1000) / 1000; } + function GetPressure(CO2, T1, T2) { + var F = T2 * 1.8 + 32; + var V = CO2 - ResCO2(CO2, T1); + if (V < 0) + return 0; + var P = -1.09145427669121 + 0.00800006989646477 * T2 + 0.000260276315484684 * T2 * T2 + 0.0215142075945119 * T2 * V + + 0.674996600795854 * V + -0.00471757220150754 * V * V; + //console.log("CO2: "+CO2+" "+V+" Temp: "+T1+" "+T2+" Pressure: "+P); + if (P < 0) + P = 0; + P = P * 1.01325; // atm to bar + P = Math.round(P * 10) / 10; + return P; + } + function CarbCO2ToPressure(CO2, T) { return (CO2 - (-0.000005594056 * Math.pow(T, 4) + 0.000144357886 * Math.pow(T, 3) + 0.000362999168 * T * T - 0.064872987645 * T + 1.641145175049)) / @@ -1836,6 +1858,7 @@ $("#bottle_priming_amount").val(Math.round(dataRecord.bottle_priming_amount * 10) / 10); $("#bottle_priming_total").val(dataRecord.bottle_priming_total); $("#bottle_abv").val(Math.round((ABV + dataRecord.bottle_priming_amount * 0.47 / 7.907) * 10) / 10); + $("#bottle_pressure").val(GetPressure(dataRecord.bottle_carbonation, TSec, dataRecord.bottle_carbonation_temp)); // Kegs var Pressure = CarbCO2ToPressure(dataRecord.keg_carbonation, dataRecord.keg_carbonation_temp); @@ -5799,6 +5822,8 @@ $("#bottle_priming_amount").jqxNumberInput( Show1dec ); $("#keg_priming_amount").jqxNumberInput( Show1dec ); $("#bottle_priming_total").jqxNumberInput( Show1dec ); + $("#bottle_pressure").jqxTooltip({ content: 'De maximal te verwachten druk tijdens het hergisten.' }); + $("#bottle_pressure").jqxNumberInput( Show1dec ); $("#keg_priming_total").jqxNumberInput( Show1dec ); $("#keg_forced_carb").jqxCheckBox({ theme: theme, width: 120, height: 23 }); $("#keg_pressure").jqxNumberInput( Show1dec ); diff -r def3900207cc -r cbeec46450f8 www/prod_edit.php --- a/www/prod_edit.php Fri Jun 14 20:22:16 2019 +0200 +++ b/www/prod_edit.php Sat Jun 15 17:19:07 2019 +0200 @@ -772,7 +772,8 @@
- + Maximum flesdruk in bar: +
Druk op fust bar: