A dynamic model of the activated sludge process