Potentiometric measurement of chemical oxygen demand