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
| Name | Domain | Direction |
|---|---|---|
u | signal | in |
y | signal | out |
Parameters
| Name | Unit | Default | Description |
|---|---|---|---|
on_at | 1 | 0.5 | Input level that switches the relay on |
off_at | 1 | -0.5 | Input level that switches the relay off |
y_on | 1 | 1 | Output when on |
y_off | 1 | 0 | Output when off |
Variables
| Name | Unit | Description |
|---|---|---|
on | 1 | 1 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