www/js/prod_edit.js

changeset 560
850e82c1021d
parent 559
10cc2400b5d5
child 561
dc618b8a9552
equal deleted inserted replaced
559:10cc2400b5d5 560:850e82c1021d
4059 $('#primary_end_brix').on('change', function(event) { 4059 $('#primary_end_brix').on('change', function(event) {
4060 var OBrix, FBrix, FG; 4060 var OBrix, FBrix, FG;
4061 if (dataRecord.brew_fermenter_sg >= 1.020) { 4061 if (dataRecord.brew_fermenter_sg >= 1.020) {
4062 OBrix = sg_to_brix(dataRecord.brew_fermenter_sg); 4062 OBrix = sg_to_brix(dataRecord.brew_fermenter_sg);
4063 FBrix = parseFloat(event.args.value); 4063 FBrix = parseFloat(event.args.value);
4064 // Brouwhulp, werkt zonder brix_correctie, waarom?
4064 FG = Round(1.0031 - 0.002318474 * OBrix - 0.000007775 * (OBrix * OBrix) - 0.000000034 * Math.pow(OBrix, 3) + 4065 FG = Round(1.0031 - 0.002318474 * OBrix - 0.000007775 * (OBrix * OBrix) - 0.000000034 * Math.pow(OBrix, 3) +
4065 0.00574 * (FBrix) + 0.00003344 * (FBrix * FBrix) + 0.000000086 * Math.pow(FBrix, 3), 4); 4066 0.00574 * (FBrix) + 0.00003344 * (FBrix * FBrix) + 0.000000086 * Math.pow(FBrix, 3), 4);
4066 //console.log("OBrix:"+OBrix+" FBrix:"+FBrix+" FG:"+FG); 4067 // from http://seanterrill.com FGoc = old cubix, FGnc = new cubic, FGnl = new linear
4068 var FGoc = Round(1.001843 - 0.002318474 * (OBrix / my_brix_correction) - 0.000007775 * Math.pow(OBrix / my_brix_correction, 2) -
4069 0.000000034 * Math.pow(OBrix / my_brix_correction, 3) +
4070 0.00574 * (FBrix / my_brix_correction) + 0.00003344 * Math.pow(FBrix / my_brix_correction, 2) +
4071 0.000000086 * Math.pow(FBrix / my_brix_correction, 3), 4);
4072 var FGnc = Round(1 - 0.0044993 * (OBrix / my_brix_correction) + 0.0117741 * (FBrix / my_brix_correction) +
4073 0.000275806 * Math.pow(OBrix / my_brix_correction, 2) - 0.00127169 * Math.pow(FBrix / my_brix_correction, 2) -
4074 0.00000727999 * Math.pow(OBrix / my_brix_correction, 3) + 0.0000632929 * Math.pow(FBrix / my_brix_correction, 3), 4);
4075 var FGnl = Round(1 - 0.000856829 * (OBrix / my_brix_correction) + 0.00349412 * (FBrix / my_brix_correction), 4);
4076 console.log("OBrix:" + OBrix + " FBrix:" + FBrix + " FG:" + FG + ' FGoc:' + FGoc + ' FGnc:' + FGnc + ' FGnl:' + FGnl);
4067 if (FBrix > 0.05) { 4077 if (FBrix > 0.05) {
4068 $('#primary_end_sg').val(FG); 4078 $('#primary_end_sg').val(FGnc);
4069 dataRecord.primary_end_sg = FG; 4079 dataRecord.primary_end_sg = FGnc;
4070 } 4080 }
4071 calcFermentation(); 4081 calcFermentation();
4072 } 4082 }
4073 }); 4083 });
4074 $('#secondary_end_sg').on('change', function(event) { 4084 $('#secondary_end_sg').on('change', function(event) {
4080 if (dataRecord.brew_fermenter_sg >= 1.020) { 4090 if (dataRecord.brew_fermenter_sg >= 1.020) {
4081 OBrix = sg_to_brix(dataRecord.brew_fermenter_sg); 4091 OBrix = sg_to_brix(dataRecord.brew_fermenter_sg);
4082 FBrix = parseFloat(event.args.value); 4092 FBrix = parseFloat(event.args.value);
4083 FG = Round(1.0031 - 0.002318474 * OBrix - 0.000007775 * (OBrix * OBrix) - 0.000000034 * Math.pow(OBrix, 3) + 4093 FG = Round(1.0031 - 0.002318474 * OBrix - 0.000007775 * (OBrix * OBrix) - 0.000000034 * Math.pow(OBrix, 3) +
4084 0.00574 * (FBrix) + 0.00003344 * (FBrix * FBrix) + 0.000000086 * Math.pow(FBrix, 3), 4); 4094 0.00574 * (FBrix) + 0.00003344 * (FBrix * FBrix) + 0.000000086 * Math.pow(FBrix, 3), 4);
4085 //console.log("OBrix:"+OBrix+" FBrix:"+FBrix+" FG:"+FG); 4095 var FGoc = Round(1.001843 - 0.002318474 * (OBrix / my_brix_correction) - 0.000007775 * Math.pow(OBrix / my_brix_correction, 2) -
4096 0.000000034 * Math.pow(OBrix / my_brix_correction, 3) +
4097 0.00574 * (FBrix / my_brix_correction) + 0.00003344 * Math.pow(FBrix / my_brix_correction, 2) +
4098 0.000000086 * Math.pow(FBrix / my_brix_correction, 3), 4);
4099 var FGnc = Round(1 - 0.0044993 * (OBrix / my_brix_correction) + 0.0117741 * (FBrix / my_brix_correction) +
4100 0.000275806 * Math.pow(OBrix / my_brix_correction, 2) - 0.00127169 * Math.pow(FBrix / my_brix_correction, 2) -
4101 0.00000727999 * Math.pow(OBrix / my_brix_correction, 3) + 0.0000632929 * Math.pow(FBrix / my_brix_correction, 3), 4);
4102 var FGnl = Round(1 - 0.000856829 * (OBrix / my_brix_correction) + 0.00349412 * (FBrix / my_brix_correction), 4);
4103 console.log("OBrix:" + OBrix + " FBrix:" + FBrix + " FG:" + FG + ' FGoc:' + FGoc + ' FGnc:' + FGnc + ' FGnl:' + FGnl);
4086 if (FBrix > 0.05) { 4104 if (FBrix > 0.05) {
4087 $('#secondary_end_sg').val(FG); 4105 $('#secondary_end_sg').val(FGnc);
4088 dataRecord.secondary_end_sg = FG; 4106 dataRecord.secondary_end_sg = FGnc;
4089 } 4107 }
4090 calcFermentation(); 4108 calcFermentation();
4091 } 4109 }
4092 }); 4110 });
4093 $('#final_brix').on('change', function(event) { 4111 $('#final_brix').on('change', function(event) {
4094 var OBrix, FBrix, FG; 4112 var OBrix, FBrix, FG;
4095 if (dataRecord.brew_fermenter_sg >= 1.020) { 4113 if (dataRecord.brew_fermenter_sg >= 1.020) {
4096 OBrix = sg_to_brix(dataRecord.brew_fermenter_sg); 4114 OBrix = sg_to_brix(dataRecord.brew_fermenter_sg);
4097 FBrix = parseFloat(event.args.value); 4115 FBrix = parseFloat(event.args.value);
4098 FG = Round(1.0031 - 0.002318474 * OBrix - 0.000007775 * (OBrix * OBrix) - 0.000000034 * Math.pow(OBrix, 3) + 4116 FG = Round(1.0031 - 0.002318474 * OBrix - 0.000007775 * (OBrix * OBrix) - 0.000000034 * Math.pow(OBrix, 3) +
4099 0.00574 * (FBrix) + 0.00003344 * (FBrix * FBrix) + 0.000000086 * Math.pow(FBrix, 3), 4); 4117 0.00574 * (FBrix) + 0.00003344 * (FBrix * FBrix) + 0.000000086 * Math.pow(FBrix, 3), 4);
4100 //console.log("OBrix:"+OBrix+" FBrix:"+FBrix+" FG:"+FG); 4118 // from http://seanterrill.com FGoc = old cubix, FGnc = new cubic, FGnl = new linear
4101 if (FBrix > 0.05) { 4119 var FGoc = Round(1.001843 - 0.002318474 * (OBrix / my_brix_correction) - 0.000007775 * Math.pow(OBrix / my_brix_correction, 2) -
4102 $('#fg').val(FG); 4120 0.000000034 * Math.pow(OBrix / my_brix_correction, 3) +
4103 dataRecord.fg = FG; 4121 0.00574 * (FBrix / my_brix_correction) + 0.00003344 * Math.pow(FBrix / my_brix_correction, 2) +
4122 0.000000086 * Math.pow(FBrix / my_brix_correction, 3), 4);
4123 var FGnc = Round(1 - 0.0044993 * (OBrix / my_brix_correction) + 0.0117741 * (FBrix / my_brix_correction) +
4124 0.000275806 * Math.pow(OBrix / my_brix_correction, 2) - 0.00127169 * Math.pow(FBrix / my_brix_correction, 2) -
4125 0.00000727999 * Math.pow(OBrix / my_brix_correction, 3) + 0.0000632929 * Math.pow(FBrix / my_brix_correction, 3), 4);
4126 var FGnl = Round(1 - 0.000856829 * (OBrix / my_brix_correction) + 0.00349412 * (FBrix / my_brix_correction), 4);
4127 console.log("OBrix:" + OBrix + " FBrix:" + FBrix + " FG:" + FG + ' FGoc:' + FGoc + ' FGnc:' + FGnc + ' FGnl:' + FGnl);
4128 if (FBrix > 0.05) {
4129 $('#fg').val(FGnc);
4130 dataRecord.fg = FGnc;
4104 } 4131 }
4105 calcFermentation(); 4132 calcFermentation();
4106 } 4133 }
4107 }); 4134 });
4108 $('#fg').on('change', function(event) { 4135 $('#fg').on('change', function(event) {

mercurial