kisanjong / rotalabutterfly

Planted Tank Nutrient Calculator
6 stars 8 forks source link

MGSO4*7H2O dGH error #25

Open Audionut opened 8 years ago

Audionut commented 8 years ago

The calculator is currently giving an error for dGH values with MgSO4*7H2O.

If I target 5ppm Mg, the calculator reports dGH as 0.28. Once I've remembered how the degrees of hardness is calculated in this calculator I'll be happy to make the proper pull request.

But to check the maths, Mg is 4.12 times lighter then CaCO3 (molar mass). 5ppm Mg X 4.12 = 20.6ppm CaCO3 equivalent, or 1.154 dGH.

edit: It appears that this error is also present in other nutrients that have CaCO3 equivalents. With CaCl2*2H2O a dose result of 15ppm Ca gives dGH 0.84. Ca is 2.5 times lighter then CaCO3, so 15ppm Ca x 2.5 = 37.5ppm CaCO3, or 2.1 dGH.

If the maths seems funny, think of it this way. If we add 20 grams of CaCO3 to 400 liters of water, we have a net concentration of 50ppm. This is (amount added in grams * 1000) / liters.

The molar mass of CaCO3 is 100.0869, lets round it off to 100 to make the maths easy. The molar mass of Ca is 40.078, lets round it off to 40. The molar mass of CO3 is 60.0089, lets round it off to 60.

So we can see that Ca is 40% (by weight) of CaCO3, with CO3 being the remaining 60% of weight.

Lets check some maths. Ca is 2.5 times lighter then CaCO3, so 40 (the molar mass of Ca) x 2.5 = 100 (the molar mass of CaCO3). Check. So 50ppm of net concentration CaCO3 is 50 / 2.5 = 20ppm Ca. Or, 20ppm Ca * 2.5 = 50ppm CaCO3 equivalent.

Audionut commented 8 years ago

Pull request #27 fixes this.

kisanjong commented 8 years ago

ive now merged all audionuts patches into the dev and have also added them to rotalabutterfly

thanks audionut :)