www/js/global.js

changeset 282
f765249d57d7
parent 278
dc22dd5d77fd
child 286
124af734af68
equal deleted inserted replaced
281:fef03c7ae353 282:f765249d57d7
115 115
116 var HopFormData = [ 116 var HopFormData = [
117 { id: 0, en: 'Pellet', nl: 'pellets' }, 117 { id: 0, en: 'Pellet', nl: 'pellets' },
118 { id: 1, en: 'Plug', nl: 'plugs' }, 118 { id: 1, en: 'Plug', nl: 'plugs' },
119 { id: 2, en: 'Leaf', nl: 'bellen' } 119 { id: 2, en: 'Leaf', nl: 'bellen' }
120 // { id: 3, en: 'Leaf wet', nl: 'bellen nat' }
120 ]; 121 ];
121 var HopFormSource = { 122 var HopFormSource = {
122 localdata: HopFormData, 123 localdata: HopFormData,
123 datatype: "array", 124 datatype: "array",
124 datafields: [{ name: 'id' }, { name: 'en' }, { name: 'nl' }] 125 datafields: [{ name: 'id' }, { name: 'en' }, { name: 'nl' }]
784 /* 785 /*
785 * Alcohol By Volume 786 * Alcohol By Volume
786 */ 787 */
787 function abvol(og, fg) { 788 function abvol(og, fg) {
788 789
790 if ((og - fg) < 0)
791 return 0;
792
793 return (76.08 * (og-fg) / (1.775-og)) * (fg / 0.794); // Daniels
794 // brouwhulp
789 if ((4.749804 - fg) != 0) 795 if ((4.749804 - fg) != 0)
790 return 486.8693 * (og - fg) / (4.749804 - fg); 796 return 486.8693 * (og - fg) / (4.749804 - fg);
791 return 0; 797 return 0;
792 } 798 }
793 799
840 pfactor += my_factor_pellet / 100; 846 pfactor += my_factor_pellet / 100;
841 } 847 }
842 if (Form == 1 ) { // Plug 848 if (Form == 1 ) { // Plug
843 pfactor += my_factor_plug / 100; 849 pfactor += my_factor_plug / 100;
844 } 850 }
851 // if (Form == 3) { // Wet leaf
852 // pfactor += 5.5; // From https://github.com/chrisgilmerproj/brewday/blob/master/brew/constants.py
853 // }
845 854
846 if (Method == 0) { // Tinseth 855 if (Method == 0) { // Tinseth
847 /* http://realbeer.com/hops/research.html */ 856 /* http://realbeer.com/hops/research.html */
848 var AddedAlphaAcids = (alpha * mass * 1000) / liters; 857 var AddedAlphaAcids = (alpha * mass * 1000) / liters;
849 var Bigness_factor = 1.65 * Math.pow( 0.000125, gravity - 1); 858 var Bigness_factor = 1.65 * Math.pow( 0.000125, gravity - 1);
956 } 965 }
957 966
958 967
959 968
960 function sg_to_plato(sg) { 969 function sg_to_plato(sg) {
961 if (sg > 0.5) 970 // http://www.brewersfriend.com/2012/10/31/on-the-relationship-between-plato-and-specific-gravity/
962 return 259 - 259 / sg; 971 return ((135.997 * sg - 630.272) * sg + 1111.14) * sg - 616.868;
963 return 0;
964 } 972 }
965 973
966 974
967 975
968 function plato_to_sg(plato) { 976 function plato_to_sg(plato) {
969 if (plato < 259) 977 return 1 + (plato / (258.6 - ((plato / 258.2) * 227.1)));
970 return 259 / (259 - plato); 978 }
971 return 1.000; 979
980
981
982 function brix_to_sg(brix) {
983 return plato_to_sg(brix / my_brix_correction);
984 }
985
986
987
988 function sg_to_brix(sg) {
989 return sg_to_plato(sg) * my_brix_correction;
972 } 990 }
973 991
974 992
975 993
976 function estimate_sg(sugars, batch_size) { 994 function estimate_sg(sugars, batch_size) {
1033 var f3d = r1d*r2d*dd; 1051 var f3d = r1d*r2d*dd;
1034 var f4d = r1d*r2d*r3d*dd; 1052 var f4d = r1d*r2d*r3d*dd;
1035 return f2d + 2*f3d + 3*f4d; 1053 return f2d + 2*f3d + 3*f4d;
1036 } 1054 }
1037 1055
1038

mercurial