# Binary limiter
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
| ID | Abbrev | Name | Type | Default | Description |
|---|---|---|---|---|---|
input | I | Input | BOOLEAN | false | A boolean input representing whether the system is actively trying to perform an action (e.g., enable signal or operational state). |
value | V | Compared value | NUMBER | 0 | A numeric input that provides the measured or calculated value to be compared against the configured limit. |
# Outputs
| ID | Abbrev | Name | Type | Default | Description |
|---|---|---|---|---|---|
output | O | Output | BOOLEAN | false | A 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_exceeded | L | Limit exceeded | BOOLEAN | false | A boolean output that is true only if the value exceeds the limit set (incl. hysteresis). |
# Configuration
| ID | Name | Type | Default | Unit | Description |
|---|---|---|---|---|---|
limit | Value limit | NUMBER | 0.0 | The 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. | |
hysteresis | Hysteresis range | NUMBER | 0.5 | A 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)
