www/js/rec_edit.js

changeset 559
10cc2400b5d5
parent 549
21705ae9dff2
child 561
dc618b8a9552
equal deleted inserted replaced
558:a8e065a9f851 559:10cc2400b5d5
492 else 492 else
493 return 0.5; 493 return 0.5;
494 } 494 }
495 495
496 496
497 function GetOptClSO4ratio() { 497 function GetOptSO4Clratio() {
498 var BUGU = GetBUGU(); 498 if (parseFloat($('#pr_sulfate').jqxNumberInput('decimal')) > 0 && parseFloat($('#pr_chloride').jqxNumberInput('decimal'))) {
499 return (-1.2 * BUGU + 1.4); 499 return (parseFloat($('#pr_sulfate').jqxNumberInput('decimal')) / parseFloat($('#pr_chloride').jqxNumberInput('decimal')));
500 } else {
501 var BUGU = GetBUGU();
502 return (-1.2 * BUGU + 1.4);
503 }
500 } 504 }
501 505
502 506
503 507
504 function setRangeIndicator(ion, rangeCode) { 508 function setRangeIndicator(ion, rangeCode) {
1532 { name: 'y_attenuation', type: 'float' }, 1536 { name: 'y_attenuation', type: 'float' },
1533 { name: 'y_use', type: 'int' }, 1537 { name: 'y_use', type: 'int' },
1534 { name: 'y_cells', type: 'float' }, 1538 { name: 'y_cells', type: 'float' },
1535 { name: 'y_tolerance', type: 'float' }, 1539 { name: 'y_tolerance', type: 'float' },
1536 { name: 'y_inventory', type: 'float' }, 1540 { name: 'y_inventory', type: 'float' },
1541 { name: 'y_sta1', type: 'int' },
1542 { name: 'y_bacteria', type: 'int' },
1543 { name: 'y_harvest_top', type: 'int' },
1544 { name: 'y_harvest_time', type: 'int' },
1545 { name: 'y_pitch_temperature', type: 'float' },
1546 { name: 'y_pofpos', type: 'int' },
1547 { name: 'y_zymocide', type: 'int' },
1537 { name: 'y_avail', type: 'int' } 1548 { name: 'y_avail', type: 'int' }
1538 ], 1549 ],
1539 addrow: function(rowid, rowdata, position, commit) { 1550 addrow: function(rowid, rowdata, position, commit) {
1540 //console.log("yeast addrow "+rowid); 1551 //console.log("yeast addrow "+rowid);
1541 commit(true); 1552 commit(true);
1598 row['y_attenuation'] = datarecord.attenuation; 1609 row['y_attenuation'] = datarecord.attenuation;
1599 row['y_flocculation'] = datarecord.flocculation; 1610 row['y_flocculation'] = datarecord.flocculation;
1600 row['y_cells'] = datarecord.cells; 1611 row['y_cells'] = datarecord.cells;
1601 row['y_tolerance'] = datarecord.tolerance; 1612 row['y_tolerance'] = datarecord.tolerance;
1602 row['y_inventory'] = datarecord.inventory; 1613 row['y_inventory'] = datarecord.inventory;
1614 row['y_sta1'] = datarecord.sta1;
1615 row['y_bacteria'] = datarecord.bacteria;
1616 row['y_harvest_top'] = datarecord.harvest_top;
1617 row['y_harvest_time'] = datarecord.harvest_time;
1618 row['y_pitch_temperature'] = datarecord.pitch_temperature;
1619 row['y_pofpos'] = datarecord.pofpos;
1620 row['y_zymocide'] = datarecord.zymocide;
1603 $('#yeastGrid').jqxGrid('addrow', null, row); 1621 $('#yeastGrid').jqxGrid('addrow', null, row);
1604 } 1622 }
1605 $('#yaddrowbutton').jqxDropDownList('clearSelection'); 1623 $('#yaddrowbutton').jqxDropDownList('clearSelection');
1606 }); 1624 });
1607 $('#yinstockbutton').jqxCheckBox({ theme: theme, height: 27, disabled: (dataRecord.stage > 3) }); 1625 $('#yinstockbutton').jqxCheckBox({ theme: theme, height: 27, disabled: (dataRecord.stage > 3) });
1918 TpH = 0, 1936 TpH = 0,
1919 protonDeficit = 0, 1937 protonDeficit = 0,
1920 AT, BT, result, pK1, pK2, pK3, MolWt, AcidSG, AcidPrc, 1938 AT, BT, result, pK1, pK2, pK3, MolWt, AcidSG, AcidPrc,
1921 r1d, r2d, f1d, f2d, f3d, 1939 r1d, r2d, f1d, f2d, f3d,
1922 deltapH, deltapd, pd, n, 1940 deltapH, deltapd, pd, n,
1923 piCLSO4_low, piCLSO4_high, Res, 1941 Res,
1924 wg_calcium, wg_sodium, wg_total_alkalinity, wg_chloride, wg_sulfate, wg_bicarbonate; 1942 wg_calcium, wg_sodium, wg_total_alkalinity, wg_chloride, wg_sulfate, wg_bicarbonate;
1925 1943
1926 if (dataRecord.w1_name == '') { 1944 if (dataRecord.w1_name == '') {
1927 return; 1945 return;
1928 } 1946 }
2224 Acidmg / 1000 * MMCl / (MMCl + 1); 2242 Acidmg / 1000 * MMCl / (MMCl + 1);
2225 RA = 1000 * RA / liters; 2243 RA = 1000 * RA / liters;
2226 chloride = wg_chloride + RA; 2244 chloride = wg_chloride + RA;
2227 } 2245 }
2228 2246
2229 // 2:1 Sulfate to Chroride IPA's, Pale Ales. 2247 var BUGU = GetBUGU();
2230 // 1:1 Sulfate to Chloride Balanced 2248 $('#tgt_bu').val(Round(BUGU, 2));
2231 // 1:2 Sulfate to Chloride Malty
2232 // Note, values below are the other way, cl to so4!
2233 // So: 0.5 is IPA's, Pale Ales.
2234 // 1 Balanced
2235 // 2 Malty.
2236 $('#tgt_bu').val(Math.round(GetBUGU() * 100) / 100);
2237 // From brouwhulp. 2249 // From brouwhulp.
2238 if (GetBUGU() < 0.32) 2250 if (BUGU < 0.32)
2239 $('#wr_bu').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Zeer moutig en zoet</span>"); 2251 $('#wr_bu').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Zeer moutig en zoet</span>");
2240 else if (GetBUGU() < 0.43) 2252 else if (BUGU < 0.43)
2241 $('#wr_bu').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Moutig, zoet</span>"); 2253 $('#wr_bu').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Moutig, zoet</span>");
2242 else if (GetBUGU() < 0.52) 2254 else if (BUGU < 0.52)
2243 $('#wr_bu').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Evenwichtig</span>"); 2255 $('#wr_bu').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Evenwichtig</span>");
2244 else if (GetBUGU() < 0.63) 2256 else if (BUGU < 0.63)
2245 $('#wr_bu').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Licht hoppig, bitter</span>"); 2257 $('#wr_bu').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Licht hoppig, bitter</span>");
2246 else 2258 else
2247 $('#wr_bu').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Extra hoppig, zeer bitter</span>"); 2259 $('#wr_bu').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Extra hoppig, zeer bitter</span>");
2248 $('#tgt_cl_so4').val(Math.round(GetOptClSO4ratio() * 10) / 10); 2260
2249 if (sulfate > 0) 2261 // Sulfate to Chloride ratio (Palmer).
2250 RA = chloride / sulfate; 2262 var OptSO4Clratio = GetOptSO4Clratio();
2263 $('#tgt_so4_cl').val(Round(OptSO4Clratio, 1));
2264 if (OptSO4Clratio < 0.4)
2265 $('#wrt_so4_cl').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Te moutig</span>");
2266 else if (OptSO4Clratio < 0.6)
2267 $('#wrt_so4_cl').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Zeer moutig</span>");
2268 else if (OptSO4Clratio < 0.8)
2269 $('#wrt_so4_cl').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Moutig</span>");
2270 else if (OptSO4Clratio < 1.5)
2271 $('#wrt_so4_cl').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Gebalanceerd</span>");
2272 else if (OptSO4Clratio < 2.0)
2273 $('#wrt_so4_cl').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Licht bitter</span>");
2274 else if (OptSO4Clratio < 4.0)
2275 $('#wrt_so4_cl').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Bitter</span>");
2276 else if (OptSO4Clratio < 9.0)
2277 $('#wrt_so4_cl').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Zeer bitter</span>");
2278 else
2279 $('#wrt_so4_cl').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Te bitter</span>");
2280 if (chloride > 0)
2281 RA = sulfate / chloride;
2251 else 2282 else
2252 RA = 10; 2283 RA = 10;
2253 $('#got_cl_so4').val(Math.round(RA * 10) / 10); 2284 $('#got_so4_cl').val(Round(RA, 1));
2254 piCLSO4_low = 0.8 * GetOptClSO4ratio();
2255 piCLSO4_high = 1.2 * GetOptClSO4ratio();
2256 Res = 'normaal'; 2285 Res = 'normaal';
2257 if (RA < piCLSO4_low) 2286 if (RA < (0.8 * OptSO4Clratio))
2258 Res = 'laag'; 2287 Res = 'laag';
2259 else if (RA > piCLSO4_high) 2288 else if (RA > (1.2 * OptSO4Clratio))
2260 Res = 'hoog'; 2289 Res = 'hoog';
2261 setRangeIndicator('cl_so4', Res); 2290 setRangeIndicator('so4_cl', Res);
2262 2291
2263 $('#wb_calcium').val(Round(calcium, 1)); 2292 $('#wb_calcium').val(Round(calcium, 1));
2264 $('#wb_magnesium').val(Round(magnesium, 1)); 2293 $('#wb_magnesium').val(Round(magnesium, 1));
2265 $('#wb_sodium').val(Round(sodium, 1)); 2294 $('#wb_sodium').val(Round(sodium, 1));
2266 $('#wb_sulfate').val(Round(sulfate, 1)); 2295 $('#wb_sulfate').val(Round(sulfate, 1));
3512 y_attenuation: yeastData.y_attenuation, 3541 y_attenuation: yeastData.y_attenuation,
3513 y_use: yeastData.y_use, 3542 y_use: yeastData.y_use,
3514 y_cells: yeastData.y_cells, 3543 y_cells: yeastData.y_cells,
3515 y_tolerance: yeastData.y_tolerance, 3544 y_tolerance: yeastData.y_tolerance,
3516 y_inventory: yeastData.y_inventory, 3545 y_inventory: yeastData.y_inventory,
3546 y_sta1: yeastData.y_sta1,
3547 y_bacteria: yeastData.y_bacteria,
3548 y_harvest_top: yeastData.y_harvest_top,
3549 y_harvest_time: yeastData.y_harvest_time,
3550 y_pitch_temperature: yeastData.y_pitch_temperature,
3551 y_pofpos: yeastData.y_pofpos,
3552 y_zymocide: yeastData.y_zymocide,
3517 y_avail: yeastData.y_avail 3553 y_avail: yeastData.y_avail
3518 }; 3554 };
3519 $('#yeastGrid').jqxGrid('updaterow', rowID, row); 3555 $('#yeastGrid').jqxGrid('updaterow', rowID, row);
3520 calcFermentables(); 3556 calcFermentables();
3521 }); 3557 });
3558 yeastData.y_max_temperature = datarecord.max_temperature; 3594 yeastData.y_max_temperature = datarecord.max_temperature;
3559 yeastData.y_flocculation = datarecord.flocculation; 3595 yeastData.y_flocculation = datarecord.flocculation;
3560 yeastData.y_attenuation = datarecord.attenuation; 3596 yeastData.y_attenuation = datarecord.attenuation;
3561 yeastData.y_cells = datarecord.cells; 3597 yeastData.y_cells = datarecord.cells;
3562 yeastData.y_inventory = datarecord.inventory; 3598 yeastData.y_inventory = datarecord.inventory;
3599 yeastData.y_sta1 = datarecord.sta1;
3600 yeastData,y_bacteria = datarecord.bacteria;
3601 yeastData.y_harvest_top = datarecord.harvest_top;
3602 yeastData.y_harvest_time = datarecord.harvest_time;
3603 yeastData.y_pitch_temperature = datarecord.pitch_temperature;
3604 yeastData.y_pofpos = datarecord.pofpos;
3605 yeastData.y_zymocide = datarecord.zymocide;
3563 if (yeastData.y_form == 0) { 3606 if (yeastData.y_form == 0) {
3564 $('#wy_pmpt_amount').html('Pak(ken):'); 3607 $('#wy_pmpt_amount').html('Pak(ken):');
3565 } else if (yeastData.y_form == 1) { 3608 } else if (yeastData.y_form == 1 || yeastData.y_form == 6) {
3566 $('#wy_pmpt_amount').html('Gewicht gram:'); 3609 $('#wy_pmpt_amount').html('Gewicht gram:');
3567 } else { 3610 } else {
3568 $('#wy_pmpt_amount').html('Volume ml:'); 3611 $('#wy_pmpt_amount').html('Volume ml:');
3569 } 3612 }
3570 calcFermentables(); 3613 calcFermentables();
3744 $('#wg_amount').val(mash_infuse); 3787 $('#wg_amount').val(mash_infuse);
3745 }); 3788 });
3746 3789
3747 // Tab 7, Water 3790 // Tab 7, Water
3748 $('#tgt_bu').jqxNumberInput(Show2wat); 3791 $('#tgt_bu').jqxNumberInput(Show2wat);
3749 $('#tgt_cl_so4').jqxNumberInput(Show1wat); 3792 $('#tgt_so4_cl').jqxNumberInput(Show1wat);
3750 $('#got_cl_so4').jqxNumberInput(Show1wat); 3793 $('#got_so4_cl').jqxNumberInput(Show1wat);
3751 3794
3752 // Water source 1 3795 // Water source 1
3753 $('#w1_name').jqxDropDownList({ 3796 $('#w1_name').jqxDropDownList({
3754 placeHolder: 'Kies hoofd water:', 3797 placeHolder: 'Kies hoofd water:',
3755 theme: theme, 3798 theme: theme,
3878 $('#pr_sulfate').val(datarecord.sulfate); 3921 $('#pr_sulfate').val(datarecord.sulfate);
3879 $('#pr_chloride').val(datarecord.chloride); 3922 $('#pr_chloride').val(datarecord.chloride);
3880 $('#pr_sodium').val(datarecord.sodium); 3923 $('#pr_sodium').val(datarecord.sodium);
3881 $('#pr_magnesium').val(datarecord.magnesium); 3924 $('#pr_magnesium').val(datarecord.magnesium);
3882 $('#pr_total_alkalinity').val(datarecord.total_alkalinity); 3925 $('#pr_total_alkalinity').val(datarecord.total_alkalinity);
3926 calcWater();
3883 } 3927 }
3884 }); 3928 });
3885 $('#pr_calcium').jqxNumberInput(Show1wat); 3929 $('#pr_calcium').jqxNumberInput(Show1wat);
3886 $('#pr_magnesium').jqxNumberInput(Show1wat); 3930 $('#pr_magnesium').jqxNumberInput(Show1wat);
3887 $('#pr_sodium').jqxNumberInput(Show1wat); 3931 $('#pr_sodium').jqxNumberInput(Show1wat);

mercurial