www/js/global.js

changeset 429
0d2cf505957c
parent 428
a5d4467c9201
child 430
6fa1d64f7f16
--- a/www/js/global.js	Fri Jun 21 16:55:36 2019 +0200
+++ b/www/js/global.js	Thu Jun 27 13:50:27 2019 +0200
@@ -148,6 +148,11 @@
 	{ id: 2, en: 'Wheat',     nl: 'Tarwegist' },
 	{ id: 3, en: 'Wine',      nl: 'Wijngist' },
 	{ id: 4, en: 'Champagne', nl: 'Champagnegist' }
+//	{ id: 5, en: 'Brett',     nl: 'Brett' },
+//	{ id: 6, en: 'Kveik',     nl: 'Kveik' },
+//	{ id: 7, en: 'Mixed',     nl: 'Mixed' },
+//      { id: 8, en: 'Spontaneous', nl: 'Spontaan' },
+//	{ id: 9, en: 'Other',       nl: 'Overig' }
 ];
 var YeastTypeSource = {
 	localdata: YeastTypeData,
@@ -772,20 +777,17 @@
 /*
  * Alcohol By Volume
  */
-function abvol(og, fg) {
+function abvol(og,fg){
 
-	if (((og - fg) < 0) || (fg < 0.9))
+	if(((og-fg)<0)||(fg<0.9))
 		return 0;
 
 	/*
 	 * Formule van Hans Halberstadt. De constante factor is afhankelijk van de
 	 * zwaarte van het wort.
 	 */
-	var factor = og * 3157 * Math.pow(10, -5) + 9.716 * Math.pow(10, -2);
-	var result = (og * 1000 - fg * 1000) * factor;
-
-	console.log("HH abvol("+ og * 1000 + ", "+ fg * 1000 + ") factor:" + factor + " abv:" + result);
-	return result;
+	var factor=og*3157*Math.pow(10,-5)+9.716*Math.pow(10,-2);
+	return (og*1000-fg*1000)*factor;
 
 	/*
 	 * Dit lijkt goed en wordt in veel moderne software gebruikt, maar...
@@ -806,23 +808,22 @@
  * Kleurwerking naar SRM. Niet voor Halberstadt, Naudts
  */
 function kw_to_srm(colormethod, c) {
-
-	if (colormethod == 0)	// Morey
-		return 1.4922 * Math.pow(c, 0.6859);
-	if (colormethod == 1)	// Mosher
-		return 0.3 * c + 4.7;
-	if (colormethod == 2)	// Daniels
-		return 0.2 * c + 8.4;
-	if (colormethod == 3)	// Halberstadt
+	if(colormethod==0)// Morey
+		return 1.4922*Math.pow(c,0.6859);
+	if(colormethod==1)// Mosher
+		return 0.3*c+4.7;
+	if(colormethod==2)// Daniels
+		return 0.2*c+8.4;
+	if(colormethod==3)// Halberstadt
 		return 0;
-	if (colormethod == 4)
+	if(colormethod==4)// Naudts
 		return 0;
 }
 
 
 
 function kw_to_ebc(colormethod, c) {
-	return srm_to_ebc(kw_to_srm(colormethod, c));
+	return srm_to_ebc(kw_to_srm(colormethod,c));
 }
 
 
@@ -1039,10 +1040,17 @@
 	if (attenuation < 30)
 		attenuation = 77;
 
+	// 0.00825 Attenuation factor yeast
+	// 0.00817 Attenuation factor water/grain ration
+	// -0.00684 Attenuation factor mash temperature
+	// 0.00026 Attenuation factor total mash time  (at some places this is 0.0026 this is wrong!)
+	// -0.00356 Attenuation factor percentage crystal malt
+	// 0.00553 Attenuation factor percentage simple sugars
+	// 0.547 Attenuation factor constant
 	var AttBeer = 0.00825 * attenuation + 0.00817 * BD - 0.00684 * Temp + 0.00026 * TotTme - 0.00356 * percCara + 0.00553 * percSugar + 0.547;
 	var fg = Math.round((1 + (1 - AttBeer) * (og - 1)) * 10000) / 10000;
 
-	//console.log("estimate_fg("+percSugar+","+percCara+","+BD+","+TotTme+","+Temp+","+attenuation+","+og+") :"+fg);
+	console.log("estimate_fg("+percSugar+","+percCara+","+BD+","+TotTme+","+Temp+","+attenuation+","+og+") AttBeer:"+AttBeer+" fg:"+fg);
 	return fg;
 }
 

mercurial