Modelling SBR cycle management and optimization using events and workflows