2422 } |
2422 } |
2423 rowscount = $('#yeastGrid').jqxGrid('getdatainformation').rowscount; |
2423 rowscount = $('#yeastGrid').jqxGrid('getdatainformation').rowscount; |
2424 if (rowscount == 0) |
2424 if (rowscount == 0) |
2425 return; // no yeast in recipe |
2425 return; // no yeast in recipe |
2426 |
2426 |
|
2427 var maybe_starter = 0; |
2427 for (i = 0; i < rowscount; i++) { |
2428 for (i = 0; i < rowscount; i++) { |
2428 row = $('#yeastGrid').jqxGrid('getrowdata', i); |
2429 row = $('#yeastGrid').jqxGrid('getrowdata', i); |
2429 if (row.y_use == 0) { // primary |
2430 if (row.y_use == 0) { // primary |
2430 // pitchrate see https://www.brewersfriend.com/yeast-pitch-rate-and-starter-calculator/ |
2431 // pitchrate see https://www.brewersfriend.com/yeast-pitch-rate-and-starter-calculator/ |
2431 // and http://braukaiser.com/blog/blog/2012/11/03/estimating-yeast-growth/ |
2432 // and http://braukaiser.com/blog/blog/2012/11/03/estimating-yeast-growth/ |
2440 if (dataRecord.est_og > 1.060) |
2441 if (dataRecord.est_og > 1.060) |
2441 pitchrate = 1.0; |
2442 pitchrate = 1.0; |
2442 if (dataRecord.est_og > 1.076) |
2443 if (dataRecord.est_og > 1.076) |
2443 pitchrate = 1.25; // Wyeast labs. http://www.wyeastlab.com/hb_pitchrates.cfm |
2444 pitchrate = 1.25; // Wyeast labs. http://www.wyeastlab.com/hb_pitchrates.cfm |
2444 } |
2445 } |
2445 // if (row.y_form == 1) { // dry yeast |
2446 |
2446 // } else { // possible starter needed |
2447 if (row.y_form != 1) { // Not dry yeast |
2447 // } |
2448 maybe_starter = 1; |
2448 } |
2449 } |
2449 } |
2450 } |
|
2451 } |
|
2452 |
2450 needed = Round(pitchrate * volume * plato, 1); |
2453 needed = Round(pitchrate * volume * plato, 1); |
2451 console.log('calcYeast() pitchrate:' + pitchrate + ' start:' + initcells + ' needed:' + needed + ' volume:' + volume); |
|
2452 $('#need_cells').val(needed); |
2454 $('#need_cells').val(needed); |
2453 use_cells = initcells; |
2455 use_cells = initcells; |
|
2456 if (needed <= initcells) |
|
2457 maybe_starter = 0; |
|
2458 console.log('calcYeast() pitchrate:' + pitchrate + ' start:' + initcells + ' needed:' + needed + ' volume:' + volume + ' maybe_starter:' + maybe_starter); |
|
2459 |
|
2460 if (maybe_starter != dataRecord.starter_enable) { |
|
2461 dataRecord.starter_enable = maybe_starter; |
|
2462 $('#starter_enable').val(maybe_starter); |
|
2463 } |
2454 |
2464 |
2455 if (dataRecord.starter_enable) { |
2465 if (dataRecord.starter_enable) { |
2456 calcSteps(dataRecord.starter_type, initcells, needed); |
2466 calcSteps(dataRecord.starter_type, initcells, needed); |
2457 |
2467 |
2458 for (i = 1; i < 5; i++) { |
2468 for (i = 1; i < 5; i++) { |