A state event detecting algorithm for hybrid dynamic systems. (November 2015)