- Thread starter Giga Pooli
- Start date

TA of zero is way outside the normal range, and I would not expect it to work. Worse, if TA is 0, PH must be well below 5. So the example you have given can't possibly happen in the real world and none of the math should be expected to work.

PoolMath takes both TA and Boric acid levels into account when calculating PH changes in the PH section towards the top, but ignores those factors in the Effects of adding chemicals section at the bottom (which uses a much simpler approximation than the one the PH section uses).

function CalcPH()

{

var mamul = [2.0, 1.11111, 1.0, .909091, 2.16897, 1.08448 ];

var temp, adj, delta, extra;

delta=parseFloat(document.F.PHto.value)-parseFloat(document.F.PHfrom.value);

delta*=GetGallons();

temp=(parseFloat(document.F.PHfrom.value)+

parseFloat(document.F.PHto.value))/2;

adj=(192.1626 + -60.1221*temp + 6.0752*temp*temp + -0.1943*temp*temp*temp) *

(parseInt(document.F.TAfrom.value)+13.91) / 114.6;

extra=(-5.476259 + 2.414292*temp + -0.355882*temp*temp +

0.01755*temp*temp*temp) * parseInt(document.F.BORfrom.value);

extra*=delta;

delta*=adj;

if (parseFloat(document.F.PHfrom.value)<parseFloat(document.F.PHto.value)) {

// Washing soda, soda ash

temp=(delta/218.68)+(extra/218.68);

document.F.PHU1oz.value=PutWeight(temp);

document.F.PHU1vol.value=PutVolume(temp * 0.8715);

// Borax

temp=(delta/110.05)+(extra/110.05);

document.F.PHU2oz.value=PutWeight(temp);

document.F.PHU2vol.value=PutVolume(temp * 0.9586);

}

else {

document.F.PHU1oz.value=document.F.PHU1vol.value=0;

document.F.PHU2oz.value=document.F.PHU2vol.value=0;

}

if (parseFloat(document.F.PHfrom.value)>parseFloat(document.F.PHto.value)) {

// Muriatic acid

temp=(delta / -240.15 * mamul[document.F.MApop.selectedIndex])+

(extra / -240.15 * mamul[document.F.MApop.selectedIndex]);

document.F.PHD1oz.value=PutVolume(temp);

// Dry acid

temp=(delta/-178.66)+(extra/-178.66);

document.F.PHD2oz.value=PutWeight(temp);

document.F.PHD2vol.value=PutVolume(temp * 0.6657);

}

else {

document.F.PHD1oz.value=0;

document.F.PHD2oz.value=document.F.PHD2vol.value=0;

}

}

{

var mamul = [2.0, 1.11111, 1.0, .909091, 2.16897, 1.08448 ];

var temp, adj, delta, extra;

delta=parseFloat(document.F.PHto.value)-parseFloat(document.F.PHfrom.value);

delta*=GetGallons();

temp=(parseFloat(document.F.PHfrom.value)+

parseFloat(document.F.PHto.value))/2;

adj=(192.1626 + -60.1221*temp + 6.0752*temp*temp + -0.1943*temp*temp*temp) *

(parseInt(document.F.TAfrom.value)+13.91) / 114.6;

extra=(-5.476259 + 2.414292*temp + -0.355882*temp*temp +

0.01755*temp*temp*temp) * parseInt(document.F.BORfrom.value);

extra*=delta;

delta*=adj;

if (parseFloat(document.F.PHfrom.value)<parseFloat(document.F.PHto.value)) {

// Washing soda, soda ash

temp=(delta/218.68)+(extra/218.68);

document.F.PHU1oz.value=PutWeight(temp);

document.F.PHU1vol.value=PutVolume(temp * 0.8715);

// Borax

temp=(delta/110.05)+(extra/110.05);

document.F.PHU2oz.value=PutWeight(temp);

document.F.PHU2vol.value=PutVolume(temp * 0.9586);

}

else {

document.F.PHU1oz.value=document.F.PHU1vol.value=0;

document.F.PHU2oz.value=document.F.PHU2vol.value=0;

}

if (parseFloat(document.F.PHfrom.value)>parseFloat(document.F.PHto.value)) {

// Muriatic acid

temp=(delta / -240.15 * mamul[document.F.MApop.selectedIndex])+

(extra / -240.15 * mamul[document.F.MApop.selectedIndex]);

document.F.PHD1oz.value=PutVolume(temp);

// Dry acid

temp=(delta/-178.66)+(extra/-178.66);

document.F.PHD2oz.value=PutWeight(temp);

document.F.PHD2vol.value=PutVolume(temp * 0.6657);

}

else {

document.F.PHD1oz.value=0;

document.F.PHD2oz.value=document.F.PHD2vol.value=0;

}

}

adj=(192.1626 + -60.1221*Avg_PH + 6.0752*Avg_PH*Avg_PH + -0.1943*Avg_PH*Avg_PH*Avg_PH) * (Starting_TA+13.91) / 114.6;

With subsequent adjustments for borate level and which chemical is being used.

The data I used for curve fitting was calculated using chem geek's PoolEquations spreadsheet, which is based on detailed equations derived from the underlying chemistry. The math it uses is way beyond what is practical on a web page.

The 31.45% HCl has a density of 1.159 g/ml (kg/l) so one liter weighs 1159 grams and HCl is 36.46094 g/mole so that's 0.3145 * 1159 / 36.46094 = 9.997 moles/liter (M). The difference of 9x10[sup]-7[/sup] moles/liter in 40,000 liters is 0.036 moles so 0.036 * 36.46094 / 1.159 / 0.3145 = 3.6 ml. The reason the spreadsheet calculates 4.0 ml is that the assumption of the difference being 9x10[sup]-7[/sup] is wrong because it doesn't account for the dissociation of water. At 27ºC the pKa of water is 13.934 so the H[sup]+[/sup] goes from 1.00x10[sup]-7[/sup] to 1.00x10[sup]-6[/sup], but the OH[sup]-[/sup] goes from 1.16x10[sup]-7[/sup] to 1.16x10[sup]-8[/sup]. The actual hydrogen atom difference is given by the change in [H[sup]+[/sup]]-[OH[sup]-[/sup]] which is 9.884x10[sup]-7[/sup] - -0.16x10[sup]-7[/sup] = 1x10[sup]-6[/sup] so we have 1x10[sup]-6[/sup] * 40,000 * 36.46095 / 1.159 / 0.3145 = 4.0 ml which matches the spreadsheet (the spreadsheet is very slightly different in the next digit because of the small ionic strength that is slightly higher after the acid addition.