Optimisation of wastewater treatment plants