Updated sparge water acid calculation using the latest revision of A.J. deLange pdf document. Tis gives a slightly higher result for the amount of acid to add. The source table data for Lactic is updated, so mash pH is a bit higher too which is better.

Tue, 30 Apr 2019 16:12:09 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Tue, 30 Apr 2019 16:12:09 +0200
changeset 349
0e44535f7435
parent 348
5fc0f4b42224
child 350
c314277905e6
child 351
58c350f286e5

Updated sparge water acid calculation using the latest revision of A.J. deLange pdf document. Tis gives a slightly higher result for the amount of acid to add. The source table data for Lactic is updated, so mash pH is a bit higher too which is better.

www/js/prod_edit.js file | annotate | diff | comparison | revisions
--- a/www/js/prod_edit.js	Mon Apr 29 20:46:03 2019 +0200
+++ b/www/js/prod_edit.js	Tue Apr 30 16:12:09 2019 +0200
@@ -1008,10 +1008,8 @@
 	}
 
 	function setRangeIndicator(ion, rangeCode) {
-		if (rangeCode == "laag")
+		if ((rangeCode == "laag") || (rangeCode == "hoog"))
 			$("#wr_"+ion).html("<img src='images/dialog-error.png'><span style='vertical-align: top; font-size: 10px; font-style: italic;'>"+rangeCode + "</span>");
-		else if (rangeCode == "hoog")
-			$("#wr_"+ion).html("<img src='images/dialog-error.png'><span style='vertical-align: top; font-size: 10px; font-style: italic;'>"+rangeCode+"</span>");
 		else
 			$("#wr_"+ion).html("<img src='images/dialog-ok-apply.png'>");
 	}
@@ -1121,15 +1119,15 @@
 	function GetAcidSpecs(AT) {
 		switch(AT) {
 			case 0:	return {	// Melkzuur
-					pK1: 3.08,
+					pK1: 3.86,
 					pK2: 20,
 					pK3: 20,
 					MolWt: 90.08,
-					AcidSG: 1214,
-					AcidPrc: 0.88
+					AcidSG: 1214,	// 1214  1209
+					AcidPrc: 0.88	// 0.88  0.80
 				};
 			case 1:	return {	// Zoutzuur
-					pK1: -10,
+					pK1: -7,
 					pK2: 20,
 					pK3: 20,
 					MolWt: 36.46,
@@ -1145,7 +1143,7 @@
 					AcidPrc: 0.25
 				};
 			case 3:	return {	// Zwavelzuur
-					pK1: -10,
+					pK1: -1,
 					pK2: 1.92,
 					pK3: 20,
 					MolWt: 98.07,
@@ -1591,12 +1589,11 @@
 				$("#sparge_source").val(0);
 			}
 		}
-
-		console.log("calcSparge() target pH: "+TargetpH+" Source: "+Source_pH+" alkalinity: "+Source_alkalinity);
+		//console.log("calcSparge() target pH: "+TargetpH+" Source: "+Source_pH+" alkalinity: "+Source_alkalinity);
 
 		// Step 1: Compute the mole fractions of carbonic (f1o), bicarbonate (f2o) and carbonate(f3o) at the water pH
 		var r1 = Math.pow(10, Source_pH - 6.38);
-		var r2 = Math.pow(10, Source_pH - 10.33);
+		var r2 = Math.pow(10, Source_pH - 10.373);
 		var d = 1 + r1 + r1*r2;
 		var f1 = 1/d;
 		var f2 = r1/d;
@@ -1604,31 +1601,35 @@
 
 		//Step 2. Compute the mole fractions at pH = 4.3 (the pH which defines alkalinity)
 		var r143 = Math.pow(10, 4.3 - 6.38);
-		var r243 = Math.pow(10, 4.3 - 10.33);
+		var r243 = Math.pow(10, 4.3 - 10.373);
 		var d43 = 1 + r143 + r143*r243;
 		var f143 = 1/d43;
 		var f243 = r143 / d43;
 		var f343 = r143 * r243 / d43;
 
-		//Step 3. Convert the sample alkalinity to milliequivalents/L
+		//Step 3. Convert the water alkalinity to milliequivalents/L
 		var alkalinity = Source_alkalinity / 50;
+		
 		//Step 4. Solve
-		alkalinity = alkalinity / ((f143-f1)+(f3-f343));
+		var Ct = (alkalinity - 1000 * (Math.pow(10, -4.3) - Math.pow(10, -Source_pH))) / ((f143-f1)+(f3-f343));
 
 		//Step 5. Compute mole fractions at desired pH
 		var r1g = Math.pow(10, TargetpH - 6.38);
-		var r2g = Math.pow(10, TargetpH - 10.33);
+		var r2g = Math.pow(10, TargetpH - 10.373);
 		var dg = 1 + r1g + r1g*r2g;
 		var f1g = 1/dg;
 		var f2g = r1g / dg;
 		var f3g = r1g * r2g / dg;
 
 		//Step 6. Use these to compute the milliequivalents acid required per liter (mEq/L)
-		var Acid = alkalinity * ((f1g-f1)+(f3-f3g)) + Math.pow(10, -TargetpH) - Math.pow(10, -Source_pH);  //mEq/l
+		var Acid = Ct * ((f1g-f1)+(f3-f3g)) + Math.pow(10, -TargetpH) - Math.pow(10, -Source_pH);  //mEq/l
+		Acid += 0.01;	// Add acid that would be required for distilled water.
 		if (dataRecord.sparge_acid_type < 0 || dataRecord.sparge_acid_type > 3) {
 			dataRecord.sparge_acid_type = 0;
 			$("#sparge_acid_type").val(0);
 		}
+
+		//Step 8. Get the acid data.
 		var AT = dataRecord.sparge_acid_type;
 		var result = GetAcidSpecs(AT);
 		var pK1 = result.pK1;

mercurial