Ion exchange equilibria in a ternary system