A new framework for the simulation of equation-based models with variable structure. (August 2013)