www/js/prod_edit.js

changeset 415
cbeec46450f8
parent 411
077ada2dda9b
child 419
99a7f2a6976e
equal deleted inserted replaced
412:def3900207cc 415:cbeec46450f8
1785 $("#final_abv").val(ABV); 1785 $("#final_abv").val(ABV);
1786 } 1786 }
1787 } 1787 }
1788 } 1788 }
1789 1789
1790 function ResCO2(CO2, T) {
1791 //var resco2 = 0.000849151 * T * T - 0.0587512 * T + 1.71137; // brouwhulp
1792 var F = T * 1.8 + 32;
1793 var resco2 = 3.0378 - 0.050062 * F + 0.00026555 * F * F; // most of the rest
1794 //console.log("CO2: "+resco2);
1795 return resco2;
1796 }
1797
1790 function CarbCO2toS(CO2, T, SFactor) { 1798 function CarbCO2toS(CO2, T, SFactor) {
1791 // Calculation of disolved CO2 in the beer, brouwhulp. 1799 var sugar = SFactor * (CO2 - ResCO2(CO2, T)) / 0.286;
1792 var sugar = SFactor * (CO2 - (0.000849151 * T * T - 0.0587512 * T + 1.71137)) / 0.286;
1793 if (sugar < 0) 1800 if (sugar < 0)
1794 sugar = 0; 1801 sugar = 0;
1795 return Math.round(sugar * 1000) / 1000; 1802 return Math.round(sugar * 1000) / 1000;
1803 }
1804
1805 function GetPressure(CO2, T1, T2) {
1806 var F = T2 * 1.8 + 32;
1807 var V = CO2 - ResCO2(CO2, T1);
1808 if (V < 0)
1809 return 0;
1810 var P = -1.09145427669121 + 0.00800006989646477 * T2 + 0.000260276315484684 * T2 * T2 + 0.0215142075945119 * T2 * V +
1811 0.674996600795854 * V + -0.00471757220150754 * V * V;
1812 //console.log("CO2: "+CO2+" "+V+" Temp: "+T1+" "+T2+" Pressure: "+P);
1813 if (P < 0)
1814 P = 0;
1815 P = P * 1.01325; // atm to bar
1816 P = Math.round(P * 10) / 10;
1817 return P;
1796 } 1818 }
1797 1819
1798 function CarbCO2ToPressure(CO2, T) { 1820 function CarbCO2ToPressure(CO2, T) {
1799 return (CO2 - (-0.000005594056 * Math.pow(T, 4) + 0.000144357886 * Math.pow(T, 3) + 1821 return (CO2 - (-0.000005594056 * Math.pow(T, 4) + 0.000144357886 * Math.pow(T, 3) +
1800 0.000362999168 * T * T - 0.064872987645 * T + 1.641145175049)) / 1822 0.000362999168 * T * T - 0.064872987645 * T + 1.641145175049)) /
1834 } 1856 }
1835 } 1857 }
1836 $("#bottle_priming_amount").val(Math.round(dataRecord.bottle_priming_amount * 10) / 10); 1858 $("#bottle_priming_amount").val(Math.round(dataRecord.bottle_priming_amount * 10) / 10);
1837 $("#bottle_priming_total").val(dataRecord.bottle_priming_total); 1859 $("#bottle_priming_total").val(dataRecord.bottle_priming_total);
1838 $("#bottle_abv").val(Math.round((ABV + dataRecord.bottle_priming_amount * 0.47 / 7.907) * 10) / 10); 1860 $("#bottle_abv").val(Math.round((ABV + dataRecord.bottle_priming_amount * 0.47 / 7.907) * 10) / 10);
1861 $("#bottle_pressure").val(GetPressure(dataRecord.bottle_carbonation, TSec, dataRecord.bottle_carbonation_temp));
1839 1862
1840 // Kegs 1863 // Kegs
1841 var Pressure = CarbCO2ToPressure(dataRecord.keg_carbonation, dataRecord.keg_carbonation_temp); 1864 var Pressure = CarbCO2ToPressure(dataRecord.keg_carbonation, dataRecord.keg_carbonation_temp);
1842 if (Pressure < 0) 1865 if (Pressure < 0)
1843 Pressure = 0; 1866 Pressure = 0;
5797 } 5820 }
5798 }); 5821 });
5799 $("#bottle_priming_amount").jqxNumberInput( Show1dec ); 5822 $("#bottle_priming_amount").jqxNumberInput( Show1dec );
5800 $("#keg_priming_amount").jqxNumberInput( Show1dec ); 5823 $("#keg_priming_amount").jqxNumberInput( Show1dec );
5801 $("#bottle_priming_total").jqxNumberInput( Show1dec ); 5824 $("#bottle_priming_total").jqxNumberInput( Show1dec );
5825 $("#bottle_pressure").jqxTooltip({ content: 'De maximal te verwachten druk tijdens het hergisten.' });
5826 $("#bottle_pressure").jqxNumberInput( Show1dec );
5802 $("#keg_priming_total").jqxNumberInput( Show1dec ); 5827 $("#keg_priming_total").jqxNumberInput( Show1dec );
5803 $("#keg_forced_carb").jqxCheckBox({ theme: theme, width: 120, height: 23 }); 5828 $("#keg_forced_carb").jqxCheckBox({ theme: theme, width: 120, height: 23 });
5804 $("#keg_pressure").jqxNumberInput( Show1dec ); 5829 $("#keg_pressure").jqxNumberInput( Show1dec );
5805 $("#bottle_abv").jqxNumberInput( Show1dec ); 5830 $("#bottle_abv").jqxNumberInput( Show1dec );
5806 $("#keg_abv").jqxNumberInput( Show1dec ); 5831 $("#keg_abv").jqxNumberInput( Show1dec );

mercurial