Skip to content

Clamp

The Clamp operation confines a numeric input to a closed range. A value inside [Min, Max] passes through unchanged; anything below Min leaves as Min, anything above Max leaves as Max. Use it to keep a setpoint, a duty cycle or a sensor reading inside the range the rest of the graph is built for.

Min equal to Max makes Out that one value whatever arrives, and the Editor marks both fields with an info mark.

Clamp operation

Inputs

PortTypeRequiredDescription
>AnyNoOptional gate. When closed, the path stops and Out keeps its previous value.
InInteger or FloatYesThe value to confine. A non-numeric or Nil value fails the Node; its On Error verb resolves the failure.

Outputs

PortTypeDefaultDescription
OutFloatNilThe confined value. Always a Float, even when In was an Integer.

Properties

NameTypeDefaultDescription
MinNumber0Lower bound, inclusive.
MaxNumber100Upper bound, inclusive.
On ErrorComboStop this branchPer-op On Error verb (Stop this branch / Continue with the last value / Continue with the fallback). See the Error Handling guide.

State on Reload

Out is preserved across restarts.


  1. Gate check — if the Gate is connected and closed, the path stops here.

  2. Read the input — In must carry a number. Anything else fails the Node, and its On Error verb resolves the failure.

  3. Confine — the result is the input, raised to Min if it was below and lowered to Max if it was above.

  4. Emit — Out is written as a Float and the path continues.


Min: 0   Max: 100   In: 42

Out: 42.0


  • Protecting an actuator — confine a computed duty cycle to 0–100 before it reaches an MQTT Action, so an arithmetic surprise upstream cannot command an out-of-range setting.
  • Taming a sensor — hold a reading inside its physically plausible band so one spike does not distort a downstream Window average.
  • Bounding a setpoint — keep a user-supplied target within the range the equipment supports.

Clamp fails when In is unconnected, Nil, or not a number; the Node’s On Error verb resolves the failure.

VerbWhat it does
Stop this branch (default)This Node and its dependents stop; Out keeps its value and reads as a failed update.
Continue with the last valueDependents run on the value Out already holds, not stamped as new; it reads as a failed update.
Continue with the fallbackDependents run on Out’s per-output Fallback, stamped as this run’s value; it reads as a failed update. The Editor refuses a Task where the Fallback is unset.

  • The bounds are fixed at configuration time; they cannot be driven from an input port. To clamp against a computed bound, use Compare and Condition.
  • Out is always a Float. Feed it through Convert when a downstream port requires an Integer.