Calculation of water hardness