BlockWerk Documentation
⇅

Relay

Discontinuous

A hysteresis switch that toggles between two output values. Turns on when input rises above the switch-on point, and turns off when input falls below the switch-off point. The gap between the two thresholds creates hysteresis, preventing chattering around a single threshold.

Simulate in BlockWerk

Interactive sandbox directly in your browser — zero installation, WASM-powered.

Simulate in BlockWerk →

Mathematical Model

{yon,u(t)≥switchOnyoff,u(t)≤switchOffy(t−Δt),otherwise\begin{cases} y_{\text{on}}, & u(t) \ge \text{switchOn} \\ y_{\text{off}}, & u(t) \le \text{switchOff} \\ y(t-\Delta t), & \text{otherwise} \end{cases}

Inputs & Outputs

Direction ID Label Type Status
→ In in Input number Required
← Out out Output number Output

Parameters

Parameters Label Type Default Description
switchOnPoint Switch On Point number 0.5
switchOffPoint Switch Off Point number -0.5
onValue On Value number 1
offValue Off Value number 0

Usage Examples

  • Zie de ingebouwde voorbeelden in de handleiding voor een demonstratie van dit blok.

Remarks & Best Practices

  • Hysteresis gap: The gap between switchOnPoint and switchOffPoint prevents chattering around a single threshold; a wider gap means more noise immunity
  • State memory: The relay remembers its current state (on/off) and only transitions when the thresholds are crossed
  • Initial state: When the input starts between the thresholds, the relay stays in its initial off state
  • Comparator vs Relay: Use Comparator for noise-free digital signals; use Relay when you need hysteresis to suppress noise on a real sensor signal
  • Inverted logic: Swap onValue and offValue to create an inverting relay (normally-on behaviour)

Related Components

  • Comparator: Single-threshold comparison (no hysteresis)
  • DeadZone: Continuous nonlinearity
  • Switch: Signal routing based on selector