www/js/prod_edit.js

changeset 726
872a3635e4ef
parent 723
3a837905bbce
child 738
11e6bd8d8107
equal deleted inserted replaced
725:30346e5b9e12 726:872a3635e4ef
1351 { name: 'y_harvest_top', type: 'int' }, 1351 { name: 'y_harvest_top', type: 'int' },
1352 { name: 'y_harvest_time', type: 'int' }, 1352 { name: 'y_harvest_time', type: 'int' },
1353 { name: 'y_pitch_temperature', type: 'float' }, 1353 { name: 'y_pitch_temperature', type: 'float' },
1354 { name: 'y_pofpos', type: 'int' }, 1354 { name: 'y_pofpos', type: 'int' },
1355 { name: 'y_zymocide', type: 'int' }, 1355 { name: 'y_zymocide', type: 'int' },
1356 { name: 'y_gr_hl_lo', type: 'int' },
1357 { name: 'y_sg_lo', type: 'float' },
1358 { name: 'y_gr_hl_hi', type: 'int' },
1359 { name: 'y_sg_hi', type: 'float' },
1356 { name: 'y_avail', type: 'int' } 1360 { name: 'y_avail', type: 'int' }
1357 ], 1361 ],
1358 addrow: function(rowid, rowdata, position, commit) { commit(true); }, 1362 addrow: function(rowid, rowdata, position, commit) { commit(true); },
1359 deleterow: function(rowid, commit) { commit(true); }, 1363 deleterow: function(rowid, commit) { commit(true); },
1360 updaterow: function(rowid, rowdata, commit) { commit(true); } 1364 updaterow: function(rowid, rowdata, commit) { commit(true); }
1416 row['y_harvest_top'] = datarecord.harvest_top; 1420 row['y_harvest_top'] = datarecord.harvest_top;
1417 row['y_harvest_time'] = datarecord.harvest_time; 1421 row['y_harvest_time'] = datarecord.harvest_time;
1418 row['y_pitch_temperature'] = datarecord.pitch_temperature; 1422 row['y_pitch_temperature'] = datarecord.pitch_temperature;
1419 row['y_pofpos'] = datarecord.pofpos; 1423 row['y_pofpos'] = datarecord.pofpos;
1420 row['y_zymocide'] = datarecord.zymocide; 1424 row['y_zymocide'] = datarecord.zymocide;
1425 row['y_gr_hl_lo'] = datarecord.gr_hl_lo;
1426 row['y_sg_lo'] = datarecord.sg_lo;
1427 row['y_gr_hl_hi'] = datarecord.gr_hl_hi;
1428 row['y_sg_hi'] = datarecord.sg_hi;
1421 $('#yeastGrid').jqxGrid('addrow', null, row); 1429 $('#yeastGrid').jqxGrid('addrow', null, row);
1422 } 1430 }
1423 calcViability(); 1431 calcViability();
1424 calcYeast(); 1432 calcYeast();
1425 $('#yaddrowbutton').jqxDropDownList('clearSelection'); 1433 $('#yaddrowbutton').jqxDropDownList('clearSelection');
1626 console.log('ready mashs, start calculations'); 1634 console.log('ready mashs, start calculations');
1627 calcFermentables(); 1635 calcFermentables();
1628 whirlpoolHops(); 1636 whirlpoolHops();
1629 calcIBUs(); 1637 calcIBUs();
1630 calcMiscs(); 1638 calcMiscs();
1639 calcViability();
1631 showStarter(); 1640 showStarter();
1632 calcYeast(); 1641 calcYeast();
1633 calcInit(); 1642 calcInit();
1634 calcMash(); 1643 calcMash();
1635 kookTijd(); 1644 kookTijd();
1812 if (row.y_laboratory == 'White Labs') { // PurePitch 1821 if (row.y_laboratory == 'White Labs') { // PurePitch
1813 vpm = 0.95; 1822 vpm = 0.95;
1814 max = 100; 1823 max = 100;
1815 } 1824 }
1816 } else if (row.y_form == 1) { // dry yeast 1825 } else if (row.y_form == 1) { // dry yeast
1817 vpm = 0.997; 1826 vpm = 0.998;
1818 max = 100; 1827 max = 100;
1819 } else if (row.y_form == 6) { // Dried kveik 1828 } else if (row.y_form == 6) { // Dried kveik
1820 vpm = 0.92; 1829 vpm = 0.92;
1821 max = 100; 1830 max = 100;
1822 } else { // Slant, Culture, Frozen, Bottle 1831 } else { // Slant, Culture, Frozen, Bottle
2615 2624
2616 function calcYeast() { 2625 function calcYeast() {
2617 2626
2618 // Calculate needed cells. 2627 // Calculate needed cells.
2619 var plato, volume, rows, rowscount, row, i, needed, use_cells, sg = dataRecord.brew_fermenter_sg; 2628 var plato, volume, rows, rowscount, row, i, needed, use_cells, sg = dataRecord.brew_fermenter_sg;
2629
2620 if (sg <= 1.0001 && dataRecord.fg > 1.000) 2630 if (sg <= 1.0001 && dataRecord.fg > 1.000)
2621 sg = dataRecord.fg; 2631 sg = dataRecord.fg;
2622 else if (sg <= 1.0001) 2632 else if (sg <= 1.0001)
2623 sg = dataRecord.est_og; 2633 sg = dataRecord.est_og;
2624 plato = sg_to_plato(sg); 2634 plato = sg_to_plato(sg);
2639 } 2649 }
2640 rowscount = $('#yeastGrid').jqxGrid('getdatainformation').rowscount; 2650 rowscount = $('#yeastGrid').jqxGrid('getdatainformation').rowscount;
2641 if (rowscount == 0) 2651 if (rowscount == 0)
2642 return; // no yeast in recipe 2652 return; // no yeast in recipe
2643 2653
2654 $('.primary_dry').hide();
2655 $('.primary_liquid').hide();
2656
2644 var maybe_starter = 0; 2657 var maybe_starter = 0;
2645 var pitchrate = 0.75; // Yeast pitch rate default 2658 var pitchrate = 0.75; // Yeast pitch rate default
2646 for (i = 0; i < rowscount; i++) { 2659 for (i = 0; i < rowscount; i++) {
2647 row = $('#yeastGrid').jqxGrid('getrowdata', i); 2660 row = $('#yeastGrid').jqxGrid('getrowdata', i);
2648 if (row.y_use == 0) { // primary 2661 if (row.y_use == 0) { // primary
2649 // pitchrate see https://www.brewersfriend.com/yeast-pitch-rate-and-starter-calculator/ 2662 if (row.y_form == 1) {
2650 // and http://braukaiser.com/blog/blog/2012/11/03/estimating-yeast-growth/ 2663 // Dry yeast
2651 if (row.y_type == 0) { // lager yeast 2664 $('.primary_dry').show();
2652 pitchrate = 1.5; 2665 console.log('dry yeast: ' + row.y_gr_hl_lo + '@' + row.y_sg_lo + ' ' + row.y_gr_hl_hi + '@' + row.y_sg_hi);
2653 if (dataRecord.est_og > 1.060) 2666 // Build the formule with the yeast parameters.
2654 pitchrate = 2.0; 2667 // Based on https://www.lallemandbrewing.com/en/canada/brewers-corner/brewing-tools/pitching-rate-calculator/
2655 } else if (row.y_type == 6) { // Kveik 2668 var og = row.y_sg_lo;
2656 pitchrate = 0.075; 2669 var f1 = row.y_gr_hl_lo / 100;
2670 var f2 = Round(f1 / 5, 6);
2671 // After a lot of try and error, study, the best thing to increase the pitch amount is actually
2672 // use this simple formula by Lallemand. This is about the same as sugar weight increment in the wort.
2673 var multiplier = (sg <= og) ? f1 : (f1 + f2 * (sg - og) / 0.008);
2674 console.log('sg: ' + sg + ' og: ' + og + ' f1: ' + f1 + ' f2: ' + f2 + ' multiplier: ' + multiplier);
2675 // dataRecord.starter_viability
2676 var yeast_grams = Round(volume * multiplier * (100 / dataRecord.starter_viability), 2);
2677 $('#yeast_grams').val(yeast_grams);
2678 var yeast_gr_hl = Round(yeast_grams / (volume * 0.01), 2);
2679 $('#yeast_gr_hl').val(yeast_gr_hl);
2680 console.log('need ' + yeast_grams + ' grams, gr/hl: ' + yeast_gr_hl);
2681 // obj.initgram = Round(obj.volume * multiplier_yeast_needed * (100 / obj.yeastviability), 2);
2682
2657 } else { 2683 } else {
2658 pitchrate = 0.75; 2684 // Liquid yeast
2659 if (dataRecord.est_og > 1.060) 2685 $('.primary_liquid').show();
2660 pitchrate = 1.0; 2686 // pitchrate see https://www.brewersfriend.com/yeast-pitch-rate-and-starter-calculator/
2661 } 2687 // and http://braukaiser.com/blog/blog/2012/11/03/estimating-yeast-growth/
2662 if (dataRecord.yeast_pitchrate < 0.01) { 2688 if (row.y_type == 0) { // lager yeast
2663 dataRecord.yeast_pitchrate = pitchrate; 2689 pitchrate = 1.5;
2664 $('#yeast_pitchrate').val(pitchrate); 2690 if (dataRecord.est_og > 1.060)
2665 } 2691 pitchrate = 2.0;
2666 2692 } else if (row.y_type == 6) { // Kveik
2667 if (row.y_form != 1) { // Not dry yeast 2693 pitchrate = 0.075;
2694 } else {
2695 pitchrate = 0.75;
2696 if (dataRecord.est_og > 1.060)
2697 pitchrate = 1.0;
2698 }
2699 if (dataRecord.yeast_pitchrate < 0.01) {
2700 dataRecord.yeast_pitchrate = pitchrate;
2701 $('#yeast_pitchrate').val(pitchrate);
2702 }
2668 maybe_starter = 1; 2703 maybe_starter = 1;
2669 } 2704 }
2670 } 2705 }
2671 } 2706 }
2672 2707
5390 }); 5425 });
5391 5426
5392 // Tab 6, Yeasts 5427 // Tab 6, Yeasts
5393 $('#est_fg2').jqxTooltip({ content: 'Het verwachte eind SG. Dit wordt automatisch berekend.' }); 5428 $('#est_fg2').jqxTooltip({ content: 'Het verwachte eind SG. Dit wordt automatisch berekend.' });
5394 $('#est_abv2').jqxTooltip({ content: 'Verwacht alcohol volume %. Dit wordt automatisch berekend.' }); 5429 $('#est_abv2').jqxTooltip({ content: 'Verwacht alcohol volume %. Dit wordt automatisch berekend.' });
5430 $('#yeast_grams').jqxTooltip({ content: 'De gewenste totale hoeveelheid droge gist voor dit bier.' });
5431 $('#yeast_gr_hl').jqxTooltip({ content: 'De werkelijke hoeveelheid gist per hectoliter.' });
5395 $('#yeast_cells').jqxTooltip({ content: 'Het aantal miljard beschikbare gistcellen zonder eventuele starter.' }); 5432 $('#yeast_cells').jqxTooltip({ content: 'Het aantal miljard beschikbare gistcellen zonder eventuele starter.' });
5396 $('#need_cells').jqxTooltip({ content: 'Het aantal miljard nodige cellen is afhankelijk van het begin SG, biertype en volume.' }); 5433 $('#need_cells').jqxTooltip({ content: 'Het aantal miljard nodige cellen is afhankelijk van het begin SG, biertype en volume.' });
5397 $('#plato_cells').jqxTooltip({ content: 'De berekende pitchrate in miljard cellen per ml per graad Plato.' }); 5434 $('#plato_cells').jqxTooltip({ content: 'De berekende pitchrate in miljard cellen per ml per graad Plato.' });
5398 $('#yeast_prod_date').jqxTooltip({ content: 'Bij korrelgisten is meestal "best voor" datum op het zakje gedrukt.<br>Gebruik die datum maar dan twee jaar eerder als productie datum.<br>Bij White Labs is de productie datum vier maanden voor de "Best by" datum die geprint op het buisje.<br>Bij Wyeast is dit de "manufacture date" die op het pak geprint is.<br>Voor schuine buis, slurry, opkweek en gedroogd is dit de datum dat je de gist geoogst hebt.' }); 5435 $('#yeast_prod_date').jqxTooltip({ content: 'Bij korrelgisten is meestal "best voor" datum op het zakje gedrukt.<br>Gebruik die datum maar dan twee jaar eerder als productie datum.<br>Bij White Labs is de productie datum vier maanden voor de "Best by" datum die geprint op het buisje.<br>Bij Wyeast is dit de "manufacture date" die op het pak geprint is.<br>Voor schuine buis, slurry, opkweek en gedroogd is dit de datum dat je de gist geoogst hebt.' });
5399 $('#yeast_pitchrate').jqxTooltip({ content: 'De gewenste pitchrate in miljard cellen per ml per graad Plato voor de vergisting van dit bier.' }); 5436 $('#yeast_pitchrate').jqxTooltip({ content: 'De gewenste pitchrate in miljard cellen per ml per graad Plato voor de vergisting van dit bier.' });
5400 5437
5401 $('#est_fg2,#plato_cells').jqxNumberInput(Show3dec); 5438 $('#est_fg2,#plato_cells').jqxNumberInput(Show3dec);
5402 $('#est_fg2').jqxNumberInput({ width: 70 }); 5439 $('#est_fg2').jqxNumberInput({ width: 70 });
5403 $('#est_abv2').jqxNumberInput(Show2dec); 5440 $('#est_abv2').jqxNumberInput(Show2dec);
5404 $('#est_abv2').jqxNumberInput({ width: 70, symbol: '%', symbolPosition: 'right' }); 5441 $('#est_abv2').jqxNumberInput({ width: 70, symbol: '%', symbolPosition: 'right' });
5442 $('#yeast_grams').jqxNumberInput(Show1dec);
5443 $('#yeast_gr_hl').jqxNumberInput(Show1dec);
5405 $('#yeast_cells,#need_cells').jqxNumberInput(Show1dec); 5444 $('#yeast_cells,#need_cells').jqxNumberInput(Show1dec);
5406 $('#yeast_prod_date').jqxDateTimeInput(Dateopts); 5445 $('#yeast_prod_date').jqxDateTimeInput(Dateopts);
5407 $('#yeast_prod_date').on('close', function(event) { 5446 $('#yeast_prod_date').on('close', function(event) {
5408 calcViability(); 5447 calcViability();
5409 calcFermentables(); 5448 calcFermentables();
5466 y_harvest_top: yeastData.y_harvest_top, 5505 y_harvest_top: yeastData.y_harvest_top,
5467 y_harvest_time: yeastData.y_harvest_time, 5506 y_harvest_time: yeastData.y_harvest_time,
5468 y_pitch_temperature: yeastData.y_pitch_temperature, 5507 y_pitch_temperature: yeastData.y_pitch_temperature,
5469 y_pofpos: yeastData.y_pofpos, 5508 y_pofpos: yeastData.y_pofpos,
5470 y_zymocide: yeastData.y_zymocide, 5509 y_zymocide: yeastData.y_zymocide,
5510 y_gr_hl_lo: yeastData.y_gr_hl_lo,
5511 y_sg_lo: yeastData.y_sg_lo,
5512 y_gr_hl_hi: yeastData.y_gr_hl_hi,
5513 y_sg_hi: yeastData.y_sg_hi,
5471 y_avail: yeastData.y_avail 5514 y_avail: yeastData.y_avail
5472 }; 5515 };
5473 $('#yeastGrid').jqxGrid('updaterow', rowID, row); 5516 $('#yeastGrid').jqxGrid('updaterow', rowID, row);
5474 calcViability(); 5517 calcViability();
5475 calcFermentables(); 5518 calcFermentables();
5519 yeastData.y_harvest_top = datarecord.harvest_top; 5562 yeastData.y_harvest_top = datarecord.harvest_top;
5520 yeastData.y_harvest_time = datarecord.harvest_time; 5563 yeastData.y_harvest_time = datarecord.harvest_time;
5521 yeastData.y_pitch_temperature = datarecord.pitch_temperature; 5564 yeastData.y_pitch_temperature = datarecord.pitch_temperature;
5522 yeastData.y_pofpos = datarecord.pofpos; 5565 yeastData.y_pofpos = datarecord.pofpos;
5523 yeastData.y_zymocide = datarecord.zymocide; 5566 yeastData.y_zymocide = datarecord.zymocide;
5567 yeastData.y_gr_hl_lo = datarecord.gr_hl_lo;
5568 yeastData.y_sg_lo = datarecord.sg_lo;
5569 yeastData.y_gr_hl_hi = datarecord.gr_hl_hi;
5570 yeastData.y_sg_hi = datarecord.sg_hi;
5524 if (yeastData.y_form == 0) { 5571 if (yeastData.y_form == 0) {
5525 $('#wy_pmpt_amount').html('Pak(ken):'); 5572 $('#wy_pmpt_amount').html('Pak(ken):');
5526 } else if (yeastData.y_form == 1 || yeastData.y_form == 6) { 5573 } else if (yeastData.y_form == 1 || yeastData.y_form == 6) {
5527 $('#wy_pmpt_amount').html('Gewicht gram:'); 5574 $('#wy_pmpt_amount').html('Gewicht gram:');
5528 } else { 5575 } else {

mercurial