-
Notifications
You must be signed in to change notification settings - Fork 2
/
yeastcalc.html
719 lines (612 loc) · 31.7 KB
/
yeastcalc.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
<!DOCTYPE html>
<html>
<head>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-112466174-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-112466174-1');
</script>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0" />
<link rel="stylesheet" href="./css/normalize.css">
<link rel="stylesheet" href="./css/yeastcalc.css">
<link rel="stylesheet" href="./css/pikaday.css">
<script type="text/javascript" src="./js/jquery-1.9.1.js"></script>
<!-- <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> -->
<script src="./js/pikaday.js"></script>
<script src="./js/pikaday.jquery.js"></script>
<title>Yeast Calculator</title>
<script type='text/javascript'>
//<![CDATA[
// GLOBAL - Inputs
//-------
// DME Calculator - initial/default values
var StarterOG = 1.037
var StarterVolLitreDefault = 2
var StarterVolMLDefault = 2000
var StarterVolQuartDefault = 2
var StarterVolGallonDefault = 0.5
var StarterVol
// Wort Properties - initial/default values
var BatchVolGallonDefault = 5.5
var BatchVolLitreDefault = 21
var BatchVol
var BatchOG = 1.054
//Liquid Yeast Properties - initial/default values
var initialYeastBillions = 100
var initialYeastAgeDays = 1
//Aeration - intial/default value
var AerationStartVol1 = 2
var AerationStartVol2 = 0
var AerationStartVol3 = 0
// GLOBAL - Vars
var StarterVolMeasureUnitOptions
var StarterDMEWeightMeasureUnitOptions
var StarterVolUnit
var StarterVolUnitNormalized
var StarterDMEmeasureunit
var StarterVolUnitCorrected
var StarterIntermCalc
var StarterDMEgrams
var BatchVolMeasureUnitOptions
var BatchTypeOptions
var BatchVolUnitCorrected
var BatchTypeSelected
var BatchVolUnitSelected
var BatchInterimCalc1
var BatchYeastCellsNeeded
var BatchOptimalPitchingRate
var YeastAgeHighRes
var YeastAgeDays
var YeastViabilityPercentage
var YeastViableCells
var TodaysDate
var AerationMethodOptions
var AerationTypeSelected1
var AerationVolUnitCorrected1
var AerationInterim1Calc1
var AerationInterim1Calc2
var AerationTypeSelected2
var AerationTypeSelected3
$(document).ready(function() {
//Populate dropdown - Starter Volume Units
StarterVolMeasureUnitOptions = '<option value="1">Litres</option><option value="1000">ml</option><option value="0.264">Gallons</option><option value="1.056">Quarts</option>';
$("#fieldStarterVolMeasureUnit").html(StarterVolMeasureUnitOptions)
//Populate dropdown - DME Weight Units
StarterDMEWeightMeasureUnitOptions = '<option value="0.0022">Grams</option><option value="0.0625">Ounces</option>';
$("#fieldDMEWeightMeasureUnit").html(StarterDMEWeightMeasureUnitOptions)
//Populate dropdown - Batch Volume Units
BatchVolMeasureUnitOptions = '<option value="1000">Litres</option><option value="3785.4">Gallons</option>';
$('#fieldBatchVolMeasureUnit').html(BatchVolMeasureUnitOptions)
BatchTypeOptions = '<option value="750000">Ale</option><option value="1000000">Hybrid</option><option value="1500000">Lager</option>';
$('#fieldBatchTypeOptions').html(BatchTypeOptions)
AerationMethodOptions = '<option value="1">None C.White</option><option value="1.25">Intermittent Shaking (J.Zainasheff)</option><option value="1.5">Stirplate (J.Zainasheff)</option><option value="2">Stirplate (K. Troester)</option>';
$('#fieldMethodOfAeration1').html(AerationMethodOptions)
$('#fieldMethodOfAeration2').html(AerationMethodOptions)
$('#fieldMethodOfAeration3').html(AerationMethodOptions)
//Populate fields with default/initial values
$('#fieldBatchOG').val(BatchOG)
$('#fieldStarterOG').val(StarterOG)
$('#fieldYeastInitialCellCount').val(initialYeastBillions)
$('#fieldCalcYeastByDate').prop('checked', true)
$('#fieldYeastViability').prop('disabled', true)
$('#fieldAerationStartVol1').val(AerationStartVol1)
$('#fieldAerationStartVol2').val(AerationStartVol2)
$('#fieldAerationStartVol3').val(AerationStartVol3)
//If preferences have been saved (in cookie) then load them
loadPreferences()
//Setup the date picker
var datepicker = new Pikaday({
field: $('#datePickerYeastProdDate')[0],
format: 'D/M/YYYY',
toString: function(date, format) {
const day = date.getDate();
const month = date.getMonth() + 1;
const year = date.getFullYear();
return '${day}/${month}/${year}';
},
parse: function(dateString, format) {
// dateString is the result of `toString` method
const parts = dateString.split('/');
const day = parseInt(parts[0], 10);
const month = parseInt(parts[1] - 1, 10);
const year = parseInt(parts[1], 10);
return new Date(year, month, day);
},
onSelect: function() {
YeastAgeHighRes = TodaysDate - datepicker.getDate()
calculateAndUpdateYeastViability()
}
});
TodaysDate = new Date()
datepicker.setDate(TodaysDate)
$('#datePickerYeastProdDate').val(datepicker.getDate().toLocaleDateString())
//Setup event triggers
$('#datePickerYeastProdDate').change(function() {
$('#datePickerYeastProdDate').val(datepicker.getDate().toLocaleDateString())
});
$('#fieldCalcYeastByDate').change(function() {
if ($('#datePickerYeastProdDate').css('visibility') == 'visible') {
$('#datePickerYeastProdDate').css('visibility', 'hidden')
$('#labelCalcYeastByDate').css('visibility', 'hidden')
$('#fieldYeastViability').prop('disabled', false);
} else {
$('#datePickerYeastProdDate').css('visibility', 'visible')
$('#labelCalcYeastByDate').css('visibility', 'visible')
$('#fieldYeastViability').prop('disabled', true);
}
calculateAndUpdateYeastViability()
});
$('#fieldBatchVolMeasureUnit').change(function() {
if ($('#fieldBatchVolMeasureUnit option:selected').text() == "Litres") {
BatchVol = BatchVolLitreDefault
} else {
BatchVol = BatchVolGallonDefault
}
$('#fieldBatchVol').val(BatchVol)
});
$('#fieldStarterVolMeasureUnit').change(function() {
if ($('#fieldStarterVolMeasureUnit option:selected').text() == "Litres") {
StarterVol = StarterVolLitreDefault
}
else if ($('#fieldStarterVolMeasureUnit option:selected').text() == "ml") {
StarterVol = StarterVolMLDefault
}
else if ($('#fieldStarterVolMeasureUnit option:selected').text() == "Gallons") {
StarterVol = StarterVolGallonDefault
}
else if ($('#fieldStarterVolMeasureUnit option:selected').text() == "Quarts") {
StarterVol = StarterVolQuartDefault
}
$('#fieldStarterVol').val(StarterVol)
});
$("select").change(function() {
calculateAndUpdateAll()
});
$("input").keyup(function() {
calculateAndUpdateAll()
});
$('#buttonSavePreferences').click(function() {
savePreferences()
});
$('#buttonClearPreferences').click(function() {
clearPreferences()
});
//Manually trigger methods for inital load
calculateAndUpdateAll()
});
function calculateAndUpdateCellsNeeded() {
BatchOG = $('#fieldBatchOG').val()
BatchVol = $('#fieldBatchVol').val()
BatchVolUnitSelected = $("#fieldBatchVolMeasureUnit option:selected").val()
BatchVolUnitCorrected = BatchVol * BatchVolUnitSelected
BatchTypeSelected = $("#fieldBatchTypeOptions option:selected").val()
BatchInterimCalc1 = ((BatchOG * 668.72) - 463.37) - (205.347 * (BatchOG * BatchOG))
BatchYeastCellsNeeded = (BatchVolUnitCorrected * (BatchInterimCalc1 * BatchTypeSelected)) / 1000000000
$('#fieldBatchYeastCellsNeeded').val(BatchYeastCellsNeeded.toFixed(0))
BatchOptimalPitchingRate = ((((BatchYeastCellsNeeded * 1000)/ BatchVolUnitCorrected) * 10) / 10)
$('#fieldBatchOptimalPitchingRate').val(BatchOptimalPitchingRate.toFixed(1))
}
function calculateAndUpdateDMENeeded() {
StarterOG = $('#fieldStarterOG').val()
StarterVol = $('#fieldStarterVol').val()
StarterVolUnit = $("#fieldStarterVolMeasureUnit option:selected").val()
//Normalize Volume - this is horrible code
if (StarterVolUnit != 1000) { //If not LITRES
if (StarterVolUnit != 0.264) { //If not Gallons
if (StarterVolUnit != 1.056) { // If not Quarts
StarterVolUnitNormalized = 0.264
} else {
StarterVolUnitNormalized = 0.25
}
} else {
StarterVolUnitNormalized = 1
}
} else {
StarterVolUnitNormalized = 0.000264
}
//Do the DME Calc
StarterDMEmeasureunit = $("#fieldDMEWeightMeasureUnit option:selected").val()
StarterVolUnitCorrected = StarterVol * StarterVolUnitNormalized
StarterIntermCalc = ((StarterOG - 1) * 1000) * StarterVolUnitCorrected
StarterDMEgrams = (((StarterIntermCalc / 44) / StarterDMEmeasureunit) * 100) / 100
$('#fieldDMErequired').val(StarterDMEgrams.toFixed(2))
}
function calculateAndUpdateYeastViability() {
YeastAgeDays = ((YeastAgeHighRes / 86400000))
if (YeastAgeDays < 0) {
YeastAgeDays = 0
}
if ($('#fieldCalcYeastByDate').prop('checked') == true) {
YeastViabilityPercentage = Math.floor(97 * (Math.pow(2.72, (-0.008) * YeastAgeDays)))
$('#fieldYeastViability').val(YeastViabilityPercentage)
} else {
YeastViabilityPercentage = $('#fieldYeastViability').val()
}
initialYeastBillions = $("#fieldYeastInitialCellCount").val()
YeastViableCells = (initialYeastBillions * (YeastViabilityPercentage / 100) * 100) / 100
$('#fieldViableCellCount').val(YeastViableCells.toFixed(2))
}
function calculateGrowth(AerationType, StarterVolume, AdditionalCellCount) {
if (StarterVolume <= 0) {
return [0, 0, 0, 0]
}
AerationTypeSelected1 = AerationType
AerationStartVol1 = StarterVolume
AerationVolUnitCorrected1 = AerationStartVol1 / StarterVolUnit
AerationInterim1Calc1 = (((YeastViableCells + AdditionalCellCount) / AerationVolUnitCorrected1) * 1000) / 1000
//console.log('Aeration Volume Interim Calc 1 (1)', AerationInterim1Calc1)
AerationInterim1Calc2 = 12.518 * (Math.pow(AerationInterim1Calc1, -0.458))
//console.log('Aeration Volume Interim Calc 2 (1)', AerationInterim1Calc2)
if (YeastViableCells > 1) {
AerationInterim1Calc1 = (((YeastViableCells + AdditionalCellCount) / AerationVolUnitCorrected1) * 10) / 10
var totalcellsfin1 = ((YeastViableCells + AdditionalCellCount) * AerationInterim1Calc2) * AerationTypeSelected1
var newcells1 = totalcellsfin1 - (YeastViableCells + AdditionalCellCount)
var numdoub1 = ((newcells1 / (YeastViableCells + AdditionalCellCount)) * 100) / 100
} else {
var totalcellsfin1 = ((((YeastViableCells + AdditionalCellCount) * AerationInterim1Calc2) * AerationTypeSelected1) * 100) / 100
var newcells1 = ((totalcellsfin1 - (YeastViableCells + AdditionalCellCount)) * 100) / 100
var numdoub1 = ((newcells1 / (YeastViableCells + AdditionalCellCount)) * 100) / 100
}
//Following code is only applicable/required for Type 2 (Stirplate Troester) option
var local5 = AerationStartVol1 * StarterVolUnitNormalized
var local6 = ((StarterOG - 1) * 1000) * local5
var int1 = (local6 / 44) / 0.0022
var number6 = (YeastViableCells + AdditionalCellCount) / int1
//console.log('Aeration int1 (1)', int1)
//console.log('Aeration number 6 (1)', number6)
if (AerationTypeSelected1 != 2) { // If Aeration type isn't Type 2 (Stirplate Troester)
//Nothing
//console.log('Aeration (1) - 2 !== AerationTypeSelected1', AerationTypeSelected1)
} else {
if (number6 > 3.5) {
//console.log('Aeration (1) - number6 < 3.5')
var local9 = 0
AerationInterim1Calc1 = (((YeastViableCells + AdditionalCellCount) / AerationVolUnitCorrected1) * 10) / 10
totalcellsfin1 = local9 + (YeastViableCells + AdditionalCellCount)
newcells1 = totalcellsfin1 - (YeastViableCells + AdditionalCellCount)
numdoub1 = ((newcells1 / (YeastViableCells + AdditionalCellCount)) * 100) / 100
} else
if (number6 < 1.4) {
//console.log('Aeration (1) - number6 < 1.4')
var local9 = 1.4 * int1
//console.log('Aeration (1) - local9, int1', local9, int1)
AerationInterim1Calc1 = (((YeastViableCells + AdditionalCellCount) / AerationVolUnitCorrected1) * 10) / 10
totalcellsfin1 = (local9 + (YeastViableCells + AdditionalCellCount))
newcells1 = totalcellsfin1 - (YeastViableCells + AdditionalCellCount)
numdoub1 = ((newcells1 / (YeastViableCells + AdditionalCellCount)) * 100) / 100
} else {
//console.log('Aeration (1) - number6 >1.4 <3.5')
var local9 = (2.33 - (number6 * 0.67)) * int1
AerationInterim1Calc1 = (((YeastViableCells + AdditionalCellCount) / AerationVolUnitCorrected1) * 10) / 10
totalcellsfin1 = local9 + (YeastViableCells + AdditionalCellCount)
newcells1 = totalcellsfin1 - (YeastViableCells + AdditionalCellCount)
numdoub1 = ((newcells1 / (YeastViableCells + AdditionalCellCount)) * 100) / 100
}
}
if (number6 != 0) {
// TODO
} else {
// TODO
}
return [AerationInterim1Calc1, newcells1, totalcellsfin1, numdoub1];
}
function calculateAndUpdateAeration1() { //inputs: AerationType, YeastCellCount, Starter Vol
AerationStartVol1 = $('#fieldAerationStartVol1').val()
AerationStartVol2 = $('#fieldAerationStartVol2').val()
AerationStartVol3 = $('#fieldAerationStartVol3').val()
AerationTypeSelected1 = $("#fieldMethodOfAeration1 option:selected").val()
AerationTypeSelected2 = $("#fieldMethodOfAeration2 option:selected").val()
AerationTypeSelected3 = $("#fieldMethodOfAeration3 option:selected").val()
// Growth 1
var GrowthResults1 = calculateGrowth(AerationTypeSelected1, AerationStartVol1, 0) // respond array: AerationInterim1Calc1, newcells1, totalcellsfin1, numdoub1
$('#fieldAerationInocRate1').val(GrowthResults1[0].toFixed(0))
$('#fieldAerationNewCells1').val(GrowthResults1[1].toFixed(0))
$('#fieldAerationTotalCells1').val(GrowthResults1[2].toFixed(0))
$('#fieldAerationGrowthFactor1').val(GrowthResults1[3].toFixed(2))
if (GrowthResults1[2] >= BatchYeastCellsNeeded) {
$('#fieldAerationTotalCells1').css('color', 'green')
} else {
$('#fieldAerationTotalCells1').css('color', 'black')
}
// Growth 2
var GrowthResults2 = calculateGrowth(AerationTypeSelected2, AerationStartVol2, GrowthResults1[1]) // respond array: AerationInterim1Calc1, newcells1, totalcellsfin1, numdoub1
$('#fieldAerationInocRate2').val(GrowthResults2[0].toFixed(0))
$('#fieldAerationNewCells2').val(GrowthResults2[1].toFixed(0))
$('#fieldAerationTotalCells2').val(GrowthResults2[2].toFixed(0))
$('#fieldAerationGrowthFactor2').val(GrowthResults2[3].toFixed(2))
if (GrowthResults2[2] >= BatchYeastCellsNeeded) {
$('#fieldAerationTotalCells2').css('color', 'green')
} else {
$('#fieldAerationTotalCells2').css('color', 'black')
}
// Growth 3
var GrowthResults3 = calculateGrowth(AerationTypeSelected3, AerationStartVol3, GrowthResults1[1] + GrowthResults2[1]) // respond array: AerationInterim1Calc1, newcells1, totalcellsfin1, numdoub1
$('#fieldAerationInocRate3').val(GrowthResults3[0].toFixed(0))
$('#fieldAerationNewCells3').val(GrowthResults3[1].toFixed(0))
$('#fieldAerationTotalCells3').val(GrowthResults3[2].toFixed(0))
$('#fieldAerationGrowthFactor3').val(GrowthResults3[3].toFixed(2))
if (GrowthResults3[2] >= BatchYeastCellsNeeded) {
$('#fieldAerationTotalCells3').css('color', 'green')
} else {
$('#fieldAerationTotalCells3').css('color', 'black')
}
}
function calculateAndUpdateAll() {
calculateAndUpdateDMENeeded()
calculateAndUpdateCellsNeeded()
calculateAndUpdateYeastViability()
calculateAndUpdateAeration1()
}
function setCookie(cname, cvalue, exdays) {
var d = new Date();
d.setTime(d.getTime() + (exdays*24*60*60*1000));
var expires = "expires="+ d.toUTCString();
document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
}
function getCookie(cname) {
var name = cname + "=";
var decodedCookie = decodeURIComponent(document.cookie);
var ca = decodedCookie.split(';');
for(var i = 0; i <ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
return c.substring(name.length, c.length);
}
}
return "";
}
function savePreferences() {
setCookie("BatchVolUnitSelected", BatchVolUnitSelected, 365)
setCookie("StarterVolUnit", StarterVolUnit, 365)
setCookie("StarterDMEmeasureunit", StarterDMEmeasureunit, 365)
}
function loadPreferences() {
//Batch Volume Units
var cookieBatchVolUnitSelected = getCookie("BatchVolUnitSelected");
// If there is a Batch Volume Unit cookie, then use it
if (cookieBatchVolUnitSelected != "") {
BatchVolUnitSelected = cookieBatchVolUnitSelected
$('#fieldBatchVolMeasureUnit').val(cookieBatchVolUnitSelected)
}
else { // Else, default Batch Volume Unit to default
$('#fieldBatchVolMeasureUnit').val($("#fieldBatchVolMeasureUnit option:first").val()) //Load default first option
}
// If the Batch Volume Unit is Litres then, set Litre volume default
if ($('#fieldBatchVolMeasureUnit option:selected').text() == "Litres") {
BatchVol = BatchVolLitreDefault
} else { //Else, set to Gallon volume default
BatchVol = BatchVolGallonDefault
}
// Update the Batch Volume field
$('#fieldBatchVol').val(BatchVol)
//Starter Volume Units
var cookieStarterVolUnit = getCookie("StarterVolUnit");
// If there is a Starter Volume Unit cookie, then use it
if (cookieStarterVolUnit != "") {
StarterVolUnit = cookieStarterVolUnit
$('#fieldStarterVolMeasureUnit').val(cookieStarterVolUnit)
} else { //Else, default Starter Volume Unit to default
$('#fieldStarterVolMeasureUnit').val($("#fieldStarterVolMeasureUnit option:first").val()) //Load default
}
// IF the Starter Volume Unit is Litres then, set Litre volume default
if ($('#fieldStarterVolMeasureUnit option:selected').text() == "Litres") {
StarterVol = StarterVolLitreDefault
} //Else, If ML, then set ML volume default
else if ($('#fieldStarterVolMeasureUnit option:selected').text() == "ml") {
StarterVol = StarterVolMLDefault
} //Else, if Gallons, then set the Gallons volume default
else if ($('#fieldStarterVolMeasureUnit option:selected').text() == "Gallons") {
StarterVol = StarterVolGallonDefault
} //Else, if Quarts, then set the Quarts volume default
else if ($('#fieldStarterVolMeasureUnit option:selected').text() == "Quarts") {
StarterVol = StarterVolQuartDefault
}
//Update the Starter Volume field
$('#fieldStarterVol').val(StarterVol)
var cookieStarterDMEmeasureunit = getCookie("StarterDMEmeasureunit");
// If there is a DME Unit cookie, then use it
if (cookieStarterDMEmeasureunit != "") {
StarterDMEmeasureunit = cookieStarterDMEmeasureunit
$('#fieldDMEWeightMeasureUnit').val(cookieStarterDMEmeasureunit)
} else { //Else, default DME Unit to default
$('#fieldDMEWeightMeasureUnit').val($("#fieldDMEWeightMeasureUnit option:first").val())
}
calculateAndUpdateAll() //Update display and calulations
}
function clearPreferences() {
document.cookie = "BatchVolUnitSelected=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
document.cookie = "StarterVolUnit=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
document.cookie = "StarterDMEmeasureunit=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
loadPreferences() //Reload with defaults
}
//]]>
</script>
</head>
<body>
<div class="heading" style="height:auto">
<img src="./img/275970-200-45deg-flip.png" width="10%"></img>
</div>
<div class="containerdiv">
<div class="subcontainerdiv">
<div id="Preferences" class="sectionleft">
<div class="heading">Preferences</div>
<div class="sectiongroup">
<div class="label">Batch Volume Units:</div>
<select id="fieldBatchVolMeasureUnit"></select>
</div>
<div class="sectiongroup">
<div class="label">Starter Volume Units:</div>
<select id="fieldStarterVolMeasureUnit"></select>
</div>
<div class="sectiongroup">
<div class="label">DME Weight Units:</div>
<select id="fieldDMEWeightMeasureUnit"></select>
</div>
<div class="sectiongroup">
<input type="button" id="buttonSavePreferences" style="margin-top: 4px;" value="Save"></input>
<input type="button" id="buttonClearPreferences" style="margin-top: 4px;" value="Clear"></input>
</div>
</div>
<div id="Wort" class="sectionmiddle">
<div class="heading">Wort Properties</div>
<div class="sectiongroup">
<div class="label">Type of Fermentation<span class="tooltiptext">Choose your style of beer</span></div>
<select id="fieldBatchTypeOptions"></select>
</div>
<div class="sectiongroup">
<div class="label">Batch Volume<span class="tooltiptext">Enter your batch size</span></div>
<input type="text" id="fieldBatchVol" style="display: inline;" autocomplete="off" autocorrect="off" autocapitalize="off"></input>
</div>
<div class="sectiongroup">
<div class="label">Original Gravity [SG]<span class="tooltiptext">Enter the specific gravity of your wort</span></div>
<input type="text" id="fieldBatchOG" style="display: inline;"></input>
</div>
<div class="sectiongroup">
<div class="label">Optimal Pitching Rate [million/ml]<span class="tooltiptext">Pitching yeast at the proper rate significantly reduces the lag time before active fermentation begins, promotes complete fermentation, reduces the risk of infection, and improves the overall quality of your beer</span></div>
<input type="text" id="fieldBatchOptimalPitchingRate" class="result" readonly></input>
</div>
<div class="sectiongroup">
<div class="label">Yeast Cells needed [billions]<span class="tooltiptext">Number of yeast cells needed to achieve optimal pitching rate</span></div>
<input type="text" id="fieldBatchYeastCellsNeeded" class="result" readonly></input>
</div>
</div>
<div id="LiquidYeast" class="sectionmiddle">
<div class="heading">Liquid Yeast Properties</div>
<div class="label" style="text-align:left;width:100%;display:block;padding:5px">
<input type="checkbox" id="fieldCalcYeastByDate">Calculate Viability from Date</input>
</div>
<div class="sectiongroup">
<div class="label">Initial Cell Count [billions]<span class="tooltiptext">Enter the initial cell count. A White Labs vial or Wyeast smackpack, each contain approximately 100 billion cells. If pitching multiple vials or smackpacks enter the number of cells accordingly</span></div>
<input type="text" id="fieldYeastInitialCellCount" style="display: inline;"></input>
</div>
<div class="sectiongroup">
<div class="label" id="labelCalcYeastByDate">Production Date<span class="tooltiptext">Choose a date. For White Labs vials, the production date is 4 months prior to the 'Best Before' date. For Wyeast packs enter the date on the package</span></div>
<input type="text" id="datePickerYeastProdDate" class="datepicker" style="display: inline;" readonly></input>
</div>
<div class="sectiongroup">
<div class="label">Viability %<span class="tooltiptext">This number is valid only for yeast that has been stored under continuous refrigeration.</span></div>
<input type="text" id="fieldYeastViability" class="result"></input>
</div>
<div class="sectiongroup">
<div class="label">Viable Cell Count [billions]<span class="tooltiptext">Estimated number of viable yeast cells</span></div>
<input type="text" id="fieldViableCellCount" class="result" readonly></input>
</div>
</div>
</div>
<div class="subcontainerdiv">
<div id="DME" class="sectionleft">
<div class="heading">DME Calculator</div>
<div class="sectiongroup">
<div class="label">Gravity of Starter [SG]:<span class="tooltiptext">Enter the Gravity of your starter wort, a standard starter is between 1.030 and 1.040</span></div>
<input type="text" id="fieldStarterOG" value="" autocomplete="off" autocorrect="off" autocapitalize="off"></input>
</div>
<div class="sectiongroup">
<div class="label">Volume of starter:</div>
<input type="text" id="fieldStarterVol" value="" autocomplete="off" autocorrect="off" autocapitalize="off"></input>
</div>
<div class="sectiongroup">
<div class="label">Amount of DME to add</div>
<input type="text" id="fieldDMErequired" class="result" readonly></input>
</div>
</div>
<div class="sectionmiddle">
<div id="Growth1" class="sectionmiddlegrowth">
<div class="heading">Growth</div>
<div class="heading" style="text-align:left">1st Step</div>
<div class="sectiongroup">
<div class="label">Method of Aeration<span class="tooltiptext">Choose your method of aeration</span></div>
<select id="fieldMethodOfAeration1"></select>
</div>
<div class="sectiongroup">
<div class="label" id="dddd">Starter Volume [Litres]<span class="tooltiptext">Enter the volume of your initial starter</span></div>
<input type="text" id="fieldAerationStartVol1"></input>
</div>
<div class="sectiongroup">
<div class="label">Inoculation Rate [Millions/ml]<span class="tooltiptext">To maximize the health and vitality of the yeast, keep the inoculation rate between 25 and 100 million cells per ml</span></div>
<input type="text" id="fieldAerationInocRate1" class="result" readonly></input>
</div>
<div class="sectiongroup">
<div class="label">New cells created [billions]<span class="tooltiptext">Estimated number of new yeast cells created</span></div>
<input type="text" id="fieldAerationNewCells1" class="result" readonly></input>
</div>
<div class="sectiongroup">
<div class="label">Total cells at Finish [billions]<span class="tooltiptext">Estimated number yeast at the end of fermentation</span></div>
<input type="text" id="fieldAerationTotalCells1" class="result" readonly></input>
</div>
<div class="sectiongroup">
<div class="label">Growth Factor</div>
<input type="text" id="fieldAerationGrowthFactor1" class="result" readonly></input>
</div>
</div>
<div id="Growth2" class="sectionmiddlegrowth">
<div class="heading" style="text-align:left">2nd Step</div>
<div class="sectiongroup">
<div class="label">Method of Aeration</div>
<select id="fieldMethodOfAeration2"></select>
</div>
<div class="sectiongroup">
<div class="label" id="dddd">Starter Volume [Litres]<span class="tooltiptext">Enter the volume of new wort added. For best results, decant the spent wort from the previous step before adding more</span></div>
<input type="text" id="fieldAerationStartVol2" style="display: inline;"></input>
</div>
<div class="sectiongroup">
<div class="label">Inoculation Rate [Millions/ml]<span class="tooltiptext">To maximize the health and vitality of the yeast, keep the inoculation rate between 25 and 100 million cells per ml</span></div>
<input type="text" id="fieldAerationInocRate2" class="result" readonly></input>
</div>
<div class="sectiongroup">
<div class="label">New cells created [billions]</div>
<input type="text" id="fieldAerationNewCells2" class="result" readonly></input>
</div>
<div class="sectiongroup">
<div class="label">Total cells at Finish [billions]</div>
<input type="text" id="fieldAerationTotalCells2" class="result" readonly></input>
</div>
<div class="sectiongroup">
<div class="label">Growth Factor</div>
<input type="text" id="fieldAerationGrowthFactor2" class="result" readonly></input>
</div>
</div>
<div id="Growth3" class="sectionmiddlegrowth">
<div class="heading" style="text-align:left">3rd Step</div>
<div class="sectiongroup">
<div class="label">Method of Aeration</div>
<select id="fieldMethodOfAeration3"></select>
</div>
<div class="sectiongroup">
<div class="label" id="dddd">Starter Volume [Litres]</div>
<input type="text" id="fieldAerationStartVol3"></input>
</div>
<div class="sectiongroup">
<div class="label">Inoculation Rate [Millions/ml]<span class="tooltiptext">To maximize the health and vitality of the yeast, keep the inoculation rate between 25 and 100 million cells per ml</span></div>
<input type="text" id="fieldAerationInocRate3" class="result" readonly></input>
</div>
<div class="sectiongroup">
<div class="label">New cells created [billions]</div>
<input type="text" id="fieldAerationNewCells3" class="result" readonly></input>
</div>
<div class="sectiongroup">
<div class="label">Total cells at Finish [billions]</div>
<input type="text" id="fieldAerationTotalCells3" class="result" readonly></input>
</div>
<div class="sectiongroup">
<div class="label">Growth Factor</div>
<input type="text" id="fieldAerationGrowthFactor3" class="result" readonly></input>
</div>
<div class="sectiongroup" style="width:100%; margin: 0 auto; text-align: center; color:#808080; font-size: 10px">
<br>
<a target="_blank" href="https://github.com/dboyd13/YeastCalculator">GitHub Project</a> by <a target="_blank" href="https://twitter.com/d_b">Darran Boyd.</a>
<br>Based on the Flash based version by Dustin J. Sullivan (yeastcalc.com), then re-hosted at YeastCalculator.com by
<a target="_blank" href="http://www.homebrewtalk.com/members/TallDan/">TallDan</a>
<br>
</div>
</div>
</div>
</div>
</div>
</body>
</html>