# Binary limiter

Process

A block that takes a binary input and a numeric input, and outputs true only if the binary input is true and the numeric input does not exceed the configured numeric limit.

Binary limiter
I
V
O
L

# Inputs

IDAbbrevNameTypeDefaultDescription
inputIInputBOOLEANfalseA boolean input representing whether the system is actively trying to perform an action (e.g., enable signal or operational state).
valueVCompared valueNUMBER0A numeric input that provides the measured or calculated value to be compared against the configured limit.

# Outputs

IDAbbrevNameTypeDefaultDescription
outputOOutputBOOLEANfalseA boolean output that is true only if the binary input is true and the numeric input does not exceed the configured limit. Otherwise, it outputs false.
limit_exceededLLimit exceededBOOLEANfalseA boolean output that is true only if the value exceeds the limit set (incl. hysteresis).

# Configuration

IDNameTypeDefaultUnitDescription
limitValue limitNUMBER0.0The value against which the numeric input is compared. It is a predefined setting that determines the maximum allowable value. If the numeric input exceeds this limit, the output will be set to false.
hysteresisHysteresis rangeNUMBER0.5A margin around the Value Limit that prevents triggering changes unless the input moves outside the defined range.

# Source Code

View Volang source
in = input::get("input")
value = input::get("value")
limit_exceeded = output::get("limit_exceeded")
limit = config::get("limit")
hysteresis = config::get("hysteresis")

new_limit_exceeded = false
if (limit >= 0) {
    // Positive limit: exceeded when value is too high
    if (value <= (limit - hysteresis)) {
        new_limit_exceeded = false
    } else if ((value > (limit - hysteresis)) and (value < (limit + hysteresis))) {
        new_limit_exceeded = limit_exceeded
    } else if (value >= (limit + hysteresis)) {
        new_limit_exceeded = true
    }
} else {
    // Negative limit: exceeded when value is too low (more negative)
    if (value >= (limit + hysteresis)) {
        new_limit_exceeded = false
    } else if ((value > (limit - hysteresis)) and (value < (limit + hysteresis))) {
        new_limit_exceeded = limit_exceeded
    } else if (value <= (limit - hysteresis)) {
        new_limit_exceeded = true
    }
}

output::set("limit_exceeded", new_limit_exceeded)
output::set("output", in and !new_limit_exceeded)
A block that takes a binary input and a numeric input, and outputs true only if the binary input is true and the numeric input does not exceed the configured numeric limit.