Skip to content

Relay

Switches on and off at separate thresholds, holding its previous output between them.

y = on_value when u >= on_threshold; y = off_value when u <= off_threshold; otherwise y keeps its previous value. The first previous value is off_value.

Direction Name Type
Input u T
Output y T
Name Type Default Meaning
T type (default f64) f64 Float scalar type
on_threshold T 0.5 Input level that switches on
off_threshold T -0.5 Input level that switches off
on_value T 1.0 Output while on
off_value T 0.0 Output while off

T defaults to f64 and is a scalar float type. Keep off_threshold < on_threshold for hysteresis.

With defaults, input samples 0, 0.6, 0, -0.6 produce 0, 1, 1, 0.