hysteresis block
[sim, out] = ld_hysteresis(sim, events, in, switch_on_level, switch_off_level, initial_state, onout, offout)
in * - input
out * -output
switches out between onout and offout
initial state is either -1 (off) or 1 (on)