www/js/global.js

changeset 220
14e349ff2a10
parent 217
318aab371497
child 221
a8aabb63fbcc
equal deleted inserted replaced
219:4c21eabb3c0e 220:14e349ff2a10
123 datatype: "array", 123 datatype: "array",
124 datafields: [{ name: 'id' }, { name: 'en' }, { name: 'nl' }] 124 datafields: [{ name: 'id' }, { name: 'en' }, { name: 'nl' }]
125 }; 125 };
126 var HopFormAdapter = new $.jqx.dataAdapter(HopFormSource); 126 var HopFormAdapter = new $.jqx.dataAdapter(HopFormSource);
127 127
128 var HopUseData = [
129 { id: 0, en: 'Mash', nl: 'maischhop' },
130 { id: 1, en: 'First wort', nl: 'first wort hop' },
131 { id: 2, en: 'Boil', nl: 'koken' },
132 { id: 3, en: 'Aroma', nl: 'vlamuit' },
133 { id: 4, en: 'Whirlpool', nl: 'whirlpool' },
134 { id: 5, en: 'Dry hop', nl: 'koudhop' }
135 ];
136 var HopUseSource = {
137 localdata: HopUseData,
138 datatype: "array",
139 datafields: [{ name: 'id' }, { name: 'en' }, { name: 'nl' }]
140 };
141 var HopUseAdapter = new $.jqx.dataAdapter(HopUseSource);
142
128 var YeastTypeData = [ 143 var YeastTypeData = [
129 { id: 0, en: 'Lager', nl: 'ondergist' }, 144 { id: 0, en: 'Lager', nl: 'ondergist' },
130 { id: 1, en: 'Ale', nl: 'bovengist' }, 145 { id: 1, en: 'Ale', nl: 'bovengist' },
131 { id: 2, en: 'Wheat', nl: 'weizengist' }, 146 { id: 2, en: 'Wheat', nl: 'weizengist' },
132 { id: 3, en: 'Wine', nl: 'wijngist' }, 147 { id: 3, en: 'Wine', nl: 'wijngist' },
151 localdata: YeastFormData, 166 localdata: YeastFormData,
152 datatype: "array", 167 datatype: "array",
153 datafields: [{ name: 'id' }, { name: 'en' }, { name: 'nl' }, { name: 'cells' }] 168 datafields: [{ name: 'id' }, { name: 'en' }, { name: 'nl' }, { name: 'cells' }]
154 }; 169 };
155 var YeastFormAdapter = new $.jqx.dataAdapter(YeastFormSource); 170 var YeastFormAdapter = new $.jqx.dataAdapter(YeastFormSource);
171
172 var YeastUseData = [
173 { id: 0, en: 'Primary', nl: 'Hoofdgisting' },
174 { id: 1, en: 'Secondary', nl: 'Nagisting' },
175 { id: 2, en: 'Tertiary', nl: 'Lagering' },
176 { id: 3, en: 'Bottle', nl: 'Bottelen' }
177 ];
178 var YeastUseSource = {
179 localdata: YeastUseData,
180 datatype: "array",
181 datafields: [{ name: 'id' }, { name: 'en' }, { name: 'nl' }, { name: 'cells' }]
182 };
183 var YeastUseAdapter = new $.jqx.dataAdapter(YeastUseSource);
156 184
157 var FlocculationData = [ 185 var FlocculationData = [
158 { id: 0, en: 'Low', nl: 'laag' }, 186 { id: 0, en: 'Low', nl: 'laag' },
159 { id: 1, en: 'Medium', nl: 'medium' }, 187 { id: 1, en: 'Medium', nl: 'medium' },
160 { id: 2, en: 'High', nl: 'hoog' }, 188 { id: 2, en: 'High', nl: 'hoog' },
340 datatype: "array", 368 datatype: "array",
341 datafields: [{ name: 'id' }, { name: 'en' }, { name: 'nl' }] 369 datafields: [{ name: 'id' }, { name: 'en' }, { name: 'nl' }]
342 }; 370 };
343 var BaseTypeAdapter = new $.jqx.dataAdapter(BaseTypeSource); 371 var BaseTypeAdapter = new $.jqx.dataAdapter(BaseTypeSource);
344 372
373 var SpargeSourceData = [
374 { id: 0, en: 'Source 1', nl: 'Bron 1' },
375 { id: 1, en: 'Source 2', nl: 'Bron 2' },
376 { id: 2, en: 'Mixed', nl: 'Gemengd' }
377 ];
378
345 379
346 // options for editors 380 // options for editors
347 381
348 var SGopts = { 382 var SGopts = {
349 inputMode: 'simple', spinMode: 'simple', theme: theme, width: 110, height: 23, min: 1.000, max: 1.199, decimalDigits: 3, spinButtons: true, spinButtonsStep: 0.001 383 inputMode: 'simple', spinMode: 'simple', theme: theme, width: 110, height: 23, min: 1.000, max: 1.199, decimalDigits: 3, spinButtons: true, spinButtonsStep: 0.001
357 var Spin2dec1 = { 391 var Spin2dec1 = {
358 inputMode: 'simple', spinMode: 'simple', theme: theme, width: 110, height: 23, min: 0, decimalDigits: 2, spinButtons: true, spinButtonsStep: 0.01 392 inputMode: 'simple', spinMode: 'simple', theme: theme, width: 110, height: 23, min: 0, decimalDigits: 2, spinButtons: true, spinButtonsStep: 0.01
359 }; 393 };
360 var Spin2dec5 = { 394 var Spin2dec5 = {
361 inputMode: 'simple', spinMode: 'simple', theme: theme, width: 110, height: 23, min: 0, decimalDigits: 2, spinButtons: true, spinButtonsStep: 0.05 395 inputMode: 'simple', spinMode: 'simple', theme: theme, width: 110, height: 23, min: 0, decimalDigits: 2, spinButtons: true, spinButtonsStep: 0.05
396 };
397 var Spin3dec5 = {
398 inputMode: 'simple', spinMode: 'simple', theme: theme, width: 110, height: 23, min: 0, decimalDigits: 3, spinButtons: true, spinButtonsStep: 0.005
362 }; 399 };
363 var SpinpH = { 400 var SpinpH = {
364 inputMode: 'simple', spinMode: 'simple', theme: theme, width: 110, height: 23, min: 1, max: 14, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1 401 inputMode: 'simple', spinMode: 'simple', theme: theme, width: 110, height: 23, min: 1, max: 14, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1
365 }; 402 };
366 var Spin2pH = { 403 var Spin2pH = {
398 { name: 'name', type: 'string' }, 435 { name: 'name', type: 'string' },
399 { name: 'category', type: 'string' }, 436 { name: 'category', type: 'string' },
400 { name: 'category_number', type: 'number' }, 437 { name: 'category_number', type: 'number' },
401 { name: 'style_letter', type: 'string' }, 438 { name: 'style_letter', type: 'string' },
402 { name: 'style_guide', type: 'string' }, 439 { name: 'style_guide', type: 'string' },
403 { name: 'type', type: 'string' }, 440 { name: 'type', type: 'int' },
404 { name: 'og_min', type: 'float' }, 441 { name: 'og_min', type: 'float' },
405 { name: 'og_max', type: 'float' }, 442 { name: 'og_max', type: 'float' },
406 { name: 'fg_min', type: 'float' }, 443 { name: 'fg_min', type: 'float' },
407 { name: 'fg_max', type: 'float' }, 444 { name: 'fg_max', type: 'float' },
408 { name: 'ibu_min', type: 'float' }, 445 { name: 'ibu_min', type: 'float' },
432 { name: 'boil_size', type: 'float' }, 469 { name: 'boil_size', type: 'float' },
433 { name: 'batch_size', type: 'float' }, 470 { name: 'batch_size', type: 'float' },
434 { name: 'tun_volume', type: 'float' }, 471 { name: 'tun_volume', type: 'float' },
435 { name: 'tun_weight', type: 'float' }, 472 { name: 'tun_weight', type: 'float' },
436 { name: 'tun_specific_heat', type: 'float' }, 473 { name: 'tun_specific_heat', type: 'float' },
437 { name: 'tun_material', type: 'string' }, 474 { name: 'tun_material', type: 'int' },
438 { name: 'tun_height', type: 'float' }, 475 { name: 'tun_height', type: 'float' },
439 { name: 'top_up_water', type: 'float' }, 476 { name: 'top_up_water', type: 'float' },
440 { name: 'trub_chiller_loss', type: 'float' }, 477 { name: 'trub_chiller_loss', type: 'float' },
441 { name: 'evap_rate', type: 'float' }, 478 { name: 'evap_rate', type: 'float' },
442 { name: 'boil_time', type: 'float' }, 479 { name: 'boil_time', type: 'float' },
443 { name: 'calc_boil_volume', type: 'bool' }, 480 { name: 'calc_boil_volume', type: 'int' },
444 { name: 'top_up_kettle', type: 'float' }, 481 { name: 'top_up_kettle', type: 'float' },
445 { name: 'hop_utilization', type: 'float' }, 482 { name: 'hop_utilization', type: 'float' },
446 { name: 'notes', type: 'string' }, 483 { name: 'notes', type: 'string' },
447 { name: 'lauter_volume', type: 'float' }, 484 { name: 'lauter_volume', type: 'float' },
448 { name: 'lauter_height', type: 'float' }, 485 { name: 'lauter_height', type: 'float' },
462 var fermentableInvSource = { 499 var fermentableInvSource = {
463 datatype: "json", 500 datatype: "json",
464 datafields: [ 501 datafields: [
465 { name: 'record', type: 'number' }, 502 { name: 'record', type: 'number' },
466 { name: 'name', type: 'string' }, 503 { name: 'name', type: 'string' },
467 { name: 'type', type: 'string' }, 504 { name: 'type', type: 'int' },
468 { name: 'yield', type: 'float' }, 505 { name: 'yield', type: 'float' },
469 { name: 'color', type: 'float' }, 506 { name: 'color', type: 'float' },
470 { name: 'add_after_boil', type: 'bool' }, 507 { name: 'add_after_boil', type: 'int' },
471 { name: 'origin', type: 'string' }, 508 { name: 'origin', type: 'string' },
472 { name: 'supplier', type: 'string' }, 509 { name: 'supplier', type: 'string' },
473 { name: 'coarse_fine_diff', type: 'float' }, 510 { name: 'coarse_fine_diff', type: 'float' },
474 { name: 'moisture', type: 'float' }, 511 { name: 'moisture', type: 'float' },
475 { name: 'diastatic_power', type: 'float' }, 512 { name: 'diastatic_power', type: 'float' },
476 { name: 'protein', type: 'float' }, 513 { name: 'protein', type: 'float' },
477 { name: 'max_in_batch', type: 'float' }, 514 { name: 'max_in_batch', type: 'float' },
478 { name: 'recommend_mash', type: 'bool' }, 515 { name: 'recommend_mash', type: 'int' },
479 { name: 'graintype', type: 'string' }, 516 { name: 'graintype', type: 'int' },
480 { name: 'di_ph', type: 'float' }, 517 { name: 'di_ph', type: 'float' },
481 { name: 'inventory', type: 'float' }, 518 { name: 'inventory', type: 'float' },
482 { name: 'cost', type: 'float' } 519 { name: 'cost', type: 'float' }
483 ], 520 ],
484 url: "getfermentablesources.php", 521 url: "getfermentablesources.php",
505 datatype: "json", 542 datatype: "json",
506 datafields: [ 543 datafields: [
507 { name: 'record', type: 'number' }, 544 { name: 'record', type: 'number' },
508 { name: 'name', type: 'string' }, 545 { name: 'name', type: 'string' },
509 { name: 'origin', type: 'string' }, 546 { name: 'origin', type: 'string' },
510 { name: 'type', type: 'string' }, 547 { name: 'type', type: 'int' },
511 { name: 'alpha', type: 'float' }, 548 { name: 'alpha', type: 'float' },
512 { name: 'beta', type: 'float' }, 549 { name: 'beta', type: 'float' },
513 { name: 'humulene', type: 'float' }, 550 { name: 'humulene', type: 'float' },
514 { name: 'caryophyllene', type: 'float' }, 551 { name: 'caryophyllene', type: 'float' },
515 { name: 'cohumulone', type: 'float' }, 552 { name: 'cohumulone', type: 'float' },
516 { name: 'myrcene', type: 'float' }, 553 { name: 'myrcene', type: 'float' },
517 { name: 'hsi', type: 'float' }, 554 { name: 'hsi', type: 'float' },
518 { name: 'useat', type: 'string' }, 555 { name: 'useat', type: 'int' },
519 { name: 'form', type: 'string' }, 556 { name: 'form', type: 'int' },
520 { name: 'total_oil', type: 'float' }, 557 { name: 'total_oil', type: 'float' },
521 { name: 'inventory', type: 'float' }, 558 { name: 'inventory', type: 'float' },
522 { name: 'cost', type: 'float' } 559 { name: 'cost', type: 'float' }
523 ], 560 ],
524 url: "gethopsources.php", 561 url: "gethopsources.php",
544 var miscInvSource = { 581 var miscInvSource = {
545 datatype: "json", 582 datatype: "json",
546 datafields: [ 583 datafields: [
547 { name: 'record', type: 'number' }, 584 { name: 'record', type: 'number' },
548 { name: 'name', type: 'string' }, 585 { name: 'name', type: 'string' },
549 { name: 'type', type: 'string' }, 586 { name: 'type', type: 'int' },
550 { name: 'use_use', type: 'string' }, 587 { name: 'use_use', type: 'int' },
551 { name: 'amount_is_weight', type: 'bool' }, 588 { name: 'amount_is_weight', type: 'int' },
552 { name: 'time', type: 'float' }, 589 { name: 'time', type: 'float' },
553 { name: 'inventory', type: 'float' }, 590 { name: 'inventory', type: 'float' },
554 { name: 'cost', type: 'float' } 591 { name: 'cost', type: 'float' }
555 ], 592 ],
556 url: "getmiscsources.php", 593 url: "getmiscsources.php",
576 var yeastInvSource = { 613 var yeastInvSource = {
577 datatype: "json", 614 datatype: "json",
578 datafields: [ 615 datafields: [
579 { name: 'record', type: 'number' }, 616 { name: 'record', type: 'number' },
580 { name: 'name', type: 'string' }, 617 { name: 'name', type: 'string' },
581 { name: 'type', type: 'string' }, 618 { name: 'type', type: 'int' },
582 { name: 'form', type: 'string' }, 619 { name: 'form', type: 'int' },
583 { name: 'laboratory', type: 'string' }, 620 { name: 'laboratory', type: 'string' },
584 { name: 'product_id', type: 'string' }, 621 { name: 'product_id', type: 'string' },
585 { name: 'min_temperature', type: 'float' }, 622 { name: 'min_temperature', type: 'float' },
586 { name: 'max_temperature', type: 'float' }, 623 { name: 'max_temperature', type: 'float' },
587 { name: 'attenuation', type: 'float' }, 624 { name: 'attenuation', type: 'float' },
611 var waterInvSource = { 648 var waterInvSource = {
612 datatype: "json", 649 datatype: "json",
613 datafields: [ 650 datafields: [
614 { name: 'record', type: 'number' }, 651 { name: 'record', type: 'number' },
615 { name: 'name', type: 'string' }, 652 { name: 'name', type: 'string' },
616 { name: 'unlimited_stock', type: 'bool' }, 653 { name: 'unlimited_stock', type: 'int' },
617 { name: 'calcium', type: 'float' }, 654 { name: 'calcium', type: 'float' },
618 { name: 'sulfate', type: 'float' }, 655 { name: 'sulfate', type: 'float' },
619 { name: 'chloride', type: 'float' }, 656 { name: 'chloride', type: 'float' },
620 { name: 'sodium', type: 'float' }, 657 { name: 'sodium', type: 'float' },
621 { name: 'magnesium', type: 'float' }, 658 { name: 'magnesium', type: 'float' },
776 /* 813 /*
777 * Kleurwerking naar SRM 814 * Kleurwerking naar SRM
778 */ 815 */
779 function kw_to_srm(colormethod, c) { 816 function kw_to_srm(colormethod, c) {
780 817
781 if (colormethod == "Morey") 818 if (colormethod == 0) // Morey
782 return 1.4922 * Math.pow(c, 0.6859); 819 return 1.4922 * Math.pow(c, 0.6859);
783 if (colormethod == "Mosher") 820 if (colormethod == 1) // Mosher
784 return 0.3 * c + 4.7; 821 return 0.3 * c + 4.7;
785 if (colormethod == "Daniels") 822 if (colormethod == 2) // Daniels
786 return 0.2 * c + 8.4; 823 return 0.2 * c + 8.4;
787 } 824 }
788 825
789 826
790 827
806 var time = parseFloat(Boiltime); 843 var time = parseFloat(Boiltime);
807 var fmoment = 1.0; 844 var fmoment = 1.0;
808 var pfactor = 1.0; 845 var pfactor = 1.0;
809 var ibu = 0; 846 var ibu = 0;
810 847
811 if ((Use == "Dry Hop") || (Use == "Dry hop") || (Use == "Whirlpool") || (Use == "Aroma")) { 848 if ((Use == 3) || (Use == 4) || (Use == 5)) { // Aroma, Whirlpool or Dry hop.
812 fmoment = 0.0; 849 fmoment = 0.0;
813 } else if (Use == "Mash") { 850 } else if (Use == 0) { // Mash
814 fmoment += my_factor_mashhop / 100; // Brouwhulp 851 fmoment += my_factor_mashhop / 100; // Brouwhulp
815 } else if ((Use == "First Wort") || (Use == "First wort")) { 852 } else if (Use == 1) { // First wort
816 fmoment += my_factor_fwh / 100; // Brouwhulp, Louis, Ozzie 853 fmoment += my_factor_fwh / 100; // Brouwhulp, Louis, Ozzie
817 } 854 }
818 855
819 if (Form == "Pellet") { 856 if (Form == 0) { // Pellet
820 pfactor += my_factor_pellet / 100; 857 pfactor += my_factor_pellet / 100;
821 } 858 }
822 if (Form == "Plug" ) { 859 if (Form == 1 ) { // Plug
823 pfactor += my_factor_plug / 100; 860 pfactor += my_factor_plug / 100;
824 } 861 }
825 862
826 if (Method == "Tinseth") { 863 if (Method == 0) { // Tinseth
827 /* http://realbeer.com/hops/research.html */ 864 /* http://realbeer.com/hops/research.html */
828 var AddedAlphaAcids = (alpha * mass * 1000) / liters; 865 var AddedAlphaAcids = (alpha * mass * 1000) / liters;
829 var Bigness_factor = 1.65 * Math.pow( 0.000125, gravity - 1); 866 var Bigness_factor = 1.65 * Math.pow( 0.000125, gravity - 1);
830 var BoilTime_factor = ((1 - Math.exp(-0.04 * time)) / 4.15); 867 var BoilTime_factor = ((1 - Math.exp(-0.04 * time)) / 4.15);
831 var utiisation = Bigness_factor * BoilTime_factor; 868 var utiisation = Bigness_factor * BoilTime_factor;
832 ibu = Math.round(utiisation * AddedAlphaAcids * fmoment * pfactor * 10) / 10.0; 869 ibu = Math.round(utiisation * AddedAlphaAcids * fmoment * pfactor * 10) / 10.0;
833 } 870 }
834 if (Method == "Daniels") { 871 if (Method == 2) { // Daniels
835 var boilfactor; 872 var boilfactor;
836 var sgfactor; 873 var sgfactor;
837 if (Form == "Leaf") 874 if (Form == 2) // Leaf
838 boilfactor = -(0.0041*time*time)+(0.6162*time)+1.5779; 875 boilfactor = -(0.0041*time*time)+(0.6162*time)+1.5779;
839 else 876 else
840 boilfactor = -(0.0051*time*time)+(0.7835*time)+1.9348; 877 boilfactor = -(0.0051*time*time)+(0.7835*time)+1.9348;
841 if (gravity < 1050) 878 if (gravity < 1050)
842 sgfactor = 0; 879 sgfactor = 0;
843 else 880 else
844 sgfactor = (gravity - 1050) / 200; 881 sgfactor = (gravity - 1050) / 200;
845 ibu = Math.round(fmoment * ((mass * (alpha * 100) * boilfactor * 0.1) / (liters * (1 + sgfactor))) * 10) / 10; 882 ibu = Math.round(fmoment * ((mass * (alpha * 100) * boilfactor * 0.1) / (liters * (1 + sgfactor))) * 10) / 10;
846 } 883 }
847 if (Method == "Rager") { 884 if (Method == 1) { // Rager
848 var boilfactor; 885 var boilfactor;
849 var sgfactor; 886 var sgfactor;
850 boilfactor = fmoment * 18.11 + 13.86 * Math.tanh((time * 31.32) / 18.27); 887 boilfactor = fmoment * 18.11 + 13.86 * Math.tanh((time * 31.32) / 18.27);
851 if (gravity < 1050) 888 if (gravity < 1050)
852 sgfactor = 0; 889 sgfactor = 0;

mercurial