  This work presents a general framework for the advanced control of a common
class of activated sludge plants (ASPs). Based on a dynamic model of the
process and plant sensors and actuators, we design and configure a highly
customisable Output Model-Predictive Controller (Output MPC) for the flexible
operation of ASPs as water resource recovery facilities. The controller
consists of a i) Moving-Horizon Estimator for determining the state of the
process, from plant measurements, and ii) a Model-Predictive Controller for
determining the optimal actions to attain high-level operational goals. The
Output MPC can be configured to satisfy the technological limits of the plant
equipment, as well as operational desiderata defined by plant personnel. We
consider exemplary problems and show that the framework is able to control ASPs
for tasks of practical relevance, ranging from wastewater treatment subject to
normative limits, to the production of an effluent with varying nitrogen
content, and energy recovery.
