Relay
DiscontinuousImplements a two-state hysteresis switch (bistable relay or Schmitt trigger). When the input signal rises above switchOnPoint, the output transitions to onValue. When the input falls below switchOffPoint, the output drops to offValue. While the input signal stays between these two thresholds, the relay holds its previous state. The hysteresis deadband prevents high-frequency chattering and contact bounce caused by sensor noise around a single transition threshold. Essential for modeling bang-bang controllers, thermostats, pressure limit switches, and digital Schmitt triggers.
Mathematical Model
The relay incorporates 1-bit discrete state memory. Its output trajectory is defined by:
where is switchOnPoint, is switchOffPoint, is onValue, and is offValue.
The total hysteresis deadband width is given by:
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
Example 1: Bang-Bang Thermostat Temperature Regulation
In thermal building HVAC modeling, an electric space heater maintains room temperature near a setpoint without causing excessive mechanical relay cycling. Routing the temperature tracking error into a Relay with switchOnPoint = 0.5 °C, switchOffPoint = -0.5 °C, onValue = 2500 W, and offValue = 0 W turns the heater on when temperature drops below and turns it off when temperature rises above , producing a stable limit-cycle.
Example 2: Schmitt Trigger Sensor Noise Rejection
In automotive wheel-speed or crankshaft sensing, inductive pickups generate low-amplitude sinusoids contaminated by electrical ripple. Passing the raw sensor voltage into a Relay with switchOnPoint = 1.8 V, switchOffPoint = 0.6 V, onValue = 5.0 V, and offValue = 0.0 V reconstructs a clean, bounce-free square wave pulse train, rejecting high-frequency noise spikes with amplitudes under .
Remarks & Best Practices
- Live Hysteresis Loop Preview: The property editor displays a real-time visualization of the bistable hysteresis loop, indicating switching thresholds, state levels, and transition directions.
- Chatter Elimination: The hysteresis band () guarantees that signal noise fluctuations within the interval cannot cause rapid switching chatter or actuator wear.
- Internal State Memory: The block retains its discrete state () when the input resides within the hysteresis deadband.
- Threshold Parameter Constraint: For normal hysteretic operation,
switchOnPointshould be strictly greater than or equal toswitchOffPoint. - Inverted Logic Capability: Setting
onValue = 0.0andoffValue = 1.0configures the block as an inverting normally-closed relay.
Related Components
- Comparator: Single-threshold comparator without hysteresis deadband.
- DeadZone: Continuous zero-output band without internal state memory.
- Switch: Multiplexes between two independent input signals.
- Backlash: Continuous mechanical hysteresis modeling gear play.