Synthesis of a state model for hysteretic devices