www/js/prod_edit.js

changeset 651
6e89cb158153
parent 649
52053730f6e1
child 655
f4e00869f39f
equal deleted inserted replaced
650:fd7da9570810 651:6e89cb158153
3403 } 3403 }
3404 } 3404 }
3405 } 3405 }
3406 } 3406 }
3407 3407
3408 function ResCO2(CO2, T) { 3408 function ResCO2(T) {
3409 var F = T * 1.8 + 32; 3409 var F = T * 1.8 + 32;
3410 return 3.0378 - 0.050062 * F + 0.00026555 * F * F; 3410 return Round(3.0378 - 0.050062 * F + 0.00026555 * F * F, 6);
3411 } 3411 }
3412 3412
3413 function CarbCO2toS(CO2, T, SFactor) { 3413 function CarbCO2toS(CO2, T, SFactor) {
3414 var sugar = SFactor * (CO2 - ResCO2(CO2, T)) / 0.286; 3414 //var sugar = SFactor * (CO2 - ResCO2(CO2, T)) / 0.286;
3415 var sugar = Round(SFactor * (CO2 - ResCO2(T)) * 4.014094, 6);
3415 if (sugar < 0) 3416 if (sugar < 0)
3416 sugar = 0; 3417 sugar = 0;
3417 return Round(sugar, 3); 3418 return Round(sugar, 3);
3418 } 3419 }
3419 3420
3420 function GetPressure(CO2, T1, T2) { 3421 function GetPressure(CO2, T1, T2) {
3421 var P, V = CO2 - ResCO2(CO2, T1); 3422 var P, V = CO2 - ResCO2(T1);
3422 V = CO2; // TODO: temp only total pressure, testing 3423 V = CO2; // TODO: temp only total pressure, testing
3423 if (V < 0) 3424 if (V < 0)
3424 return 0; 3425 return 0;
3425 P = -1.09145427669121 + 0.00800006989646477 * T2 + 0.000260276315484684 * T2 * T2 + 0.0215142075945119 * T2 * V + 3426 P = -1.09145427669121 + 0.00800006989646477 * T2 + 0.000260276315484684 * T2 * T2 + 0.0215142075945119 * T2 * V +
3426 0.674996600795854 * V + -0.00471757220150754 * V * V; 3427 0.674996600795854 * V + -0.00471757220150754 * V * V;
3427 if (P < 0) 3428 if (P < 0)
3428 P = 0; 3429 P = 0;
3429 P = Round(P * 1.01325, 2); // atm to bar 3430 P = Round(P * 1.01325, 2); // atm to bar
3430 console.log("GetPressure(" + CO2 + ", " + T1 + ", " + T2 + ") V:" + V + " Bar: " + P + " ignored ResCO2: " + Round(ResCO2(CO2, T1), 2)); 3431 console.log("GetPressure(" + CO2 + ", " + T1 + ", " + T2 + ") V:" + V + " Bar: " + P + " ignored ResCO2: " + ResCO2(T1));
3431 return P; 3432 return P;
3432 } 3433 }
3433 3434
3434 function CarbCO2ToPressure(CO2, T) { 3435 function CarbCO2ToPressure(CO2, T) {
3435 return (CO2 - (-0.000005594056 * Math.pow(T, 4) + 0.000144357886 * Math.pow(T, 3) + 3436 return (CO2 - (-0.000005594056 * Math.pow(T, 4) + 0.000144357886 * Math.pow(T, 3) +

mercurial