Logic

Comparator Block

Compares input signal to a threshold, outputs 1 (true) or 0 (false)

Open Comparator in BlockWerk →

Description

The Comparator block compares an input signal to a threshold and outputs a binary result: 1 (true) if the comparison is satisfied, 0 (false) otherwise. Essential for threshold detection, crossing detection, and generating boolean control signals.

Mathematical Model

y = \begin{cases} 1, & \text{if } u \text{ op } \text{threshold} \\ 0, & \text{otherwise} \end{cases} \\ \text{op} \in \{ \ge, >, \le, <, =, \neq \}

Parameters

threshold

The value to compare against.

operator

Comparison mode: ≥ (default), >, ≤, <, = (equal), ≠ (not equal)

trueResultMode

Type: select (Default: "constant")

True Output parameter description placeholder.

trueValue

Type: number (Default: 1)

True Constant parameter description placeholder.

falseResultMode

Type: select (Default: "constant")

False Output parameter description placeholder.

falseValue

Type: number (Default: 0)

False Constant parameter description placeholder.

Examples

Threshold Crossing Detection (1 second)

Ramp signal (0→5) compared against threshold=2.5. Output is 0 until signal crosses threshold at t=0.5s, then becomes 1.

Hysteresis Implementation

Compare high and low thresholds to create switching with hysteresis.

Remarks

See Also