A supervisor for control of mode-switch processes