Determination of ion concentrations