Relay with hysteresis

signal.relay

Switches on when the input rises above on_at and off when it falls below off_at, and holds its state in between. Outputs y_on or y_off. Starts on when the input is above on_at at t = 0, otherwise off.

Ports

NameDomainDirection
usignalin
ysignalout

Parameters

NameUnitDefaultDescription
on_at10.5Input level that switches the relay on
off_at1-0.5Input level that switches the relay off
y_on11Output when on
y_off10Output when off

Variables

NameUnitDescription
on11 while the relay is on, 0 while off

Equations

der(on) = 0
when u > on_at then reinit(on, 1)
when u < off_at then reinit(on, 0)
y = if on > 0.5 then y_on else y_off