⊂

Interval Test

Logic
Run the live example Free · no sign-up · runs in your browser

The IntervalTest block tests whether an incoming scalar input signal u(t)u(t) lies within a defined numerical interval [L,U][L, U]. The boundary limits (L=lowerLimitL = \text{lowerLimit}, U=upperLimitU = \text{upperLimit}) and their open/closed inclusivity (both, lower only, upper only, neither) are fully configurable. Depending on whether the condition is met, the block outputs either a fixed numerical constant or passes the input signal through directly. This makes it ideal for safety limit monitors, safe operating area (SOA) checks, window comparators, and conditional deadband passthroughs without needing complex boolean networks.

Mathematical Model

The interval inclusion condition is evaluated according to the inclusive mode:

in_interval⁡(u)={L≤u(t)≤U,inclusive=bothL≤u(t)<U,inclusive=lowerL<u(t)≤U,inclusive=upperL<u(t)<U,inclusive=neither\operatorname{in\_interval}(u) = \begin{cases} L \le u(t) \le U, & \text{inclusive} = \text{both} \\ L \le u(t) < U, & \text{inclusive} = \text{lower} \\ L < u(t) \le U, & \text{inclusive} = \text{upper} \\ L < u(t) < U, & \text{inclusive} = \text{neither} \end{cases}

where LL is lowerLimit and UU is upperLimit.

The block output y(t)y(t) is then determined by the condition result:

y(t)={ytrue,in_interval⁡(u)=trueyfalse,in_interval⁡(u)=falsey(t) = \begin{cases} y_{\text{true}}, & \operatorname{in\_interval}(u) = \text{true} \\ y_{\text{false}}, & \operatorname{in\_interval}(u) = \text{false} \end{cases}

where the true and false branch outputs are configured by their respective result modes:

ytrue={ctrue,trueResultMode=constantu(t),trueResultMode=input,yfalse={cfalse,falseResultMode=constantu(t),falseResultMode=inputy_{\text{true}} = \begin{cases} c_{\text{true}}, & \text{trueResultMode} = \text{constant} \\ u(t), & \text{trueResultMode} = \text{input} \end{cases}, \quad y_{\text{false}} = \begin{cases} c_{\text{false}}, & \text{falseResultMode} = \text{constant} \\ u(t), & \text{falseResultMode} = \text{input} \end{cases}

with ctrue=trueValuec_{\text{true}} = \text{trueValue} and cfalse=falseValuec_{\text{false}} = \text{falseValue}.

Inputs & Outputs

Direction ID Label Type Status
→ In in In number Required
← Out out Out number Output

Parameters

Parameters Label Type Default Description
lowerLimit Lower Limit number -1
upperLimit Upper Limit number 1
inclusive Inclusive Bounds select both
trueResultMode True Output select constant
trueValue True Constant number 1
falseResultMode False Output select constant
falseValue False Constant number 0

Usage Examples

Example 1: Battery Cell Temperature Safe Operating Area (SOA) Monitor

Monitoring lithium-ion battery temperature TcellT_{\text{cell}} in an electric vehicle Battery Management System (BMS). Setting lowerLimit = 0.0 (0∘C0^\circ\text{C}), upperLimit = 45.0 (45∘C45^\circ\text{C}), inclusive = "both", trueResultMode = "constant" with trueValue = 1.0, and falseResultMode = "constant" with falseValue = 0.0. A downstream logic switch immediately cuts off fast charging whenever cell temperature exits the safe window.

Example 2: Linear Window Passthrough with Clamped Zero Out-of-Bounds

Synthesizing a linear bandpass filter window that allows small perturbation signals through while blanking extreme disturbances. Setting lowerLimit = -5.0, upperLimit = 5.0, inclusive = "both", trueResultMode = "input", and falseResultMode = "constant" with falseValue = 0.0. Inputs inside [−5,5][-5, 5] pass through unchanged (y=uy = u), while values outside are suppressed cleanly to zero.

Remarks & Best Practices

  • Input Passthrough Flexibility: The trueResultMode and falseResultMode options allow dynamic gating of physical signals without requiring downstream Switch or Multiplexer blocks.
  • Inverted Limit Boundary Condition: If lowerLimit > upperLimit, the resulting interval is empty, causing the block to evaluate false and emit yfalsey_{\text{false}} for all finite inputs.
  • Ideal Driver for Logical Switches: In standard boolean mode (1.01.0 for true, 0.00.0 for false), the output directly drives the control input of Switch and Relay blocks.
  • Zero Computational Overhead: Evaluated directly as native scalar comparison instructions in WebAssembly with zero memory allocations or iteration loops.

Related Components

  • Comparator: Evaluates single-threshold relational comparisons (u1≥u2u_1 \ge u_2, u1>u2u_1 > u_2, etc.).
  • DeadZone: Suppresses signals within a central deadband while shifting values outside.
  • Switch: Selects between two alternative input signals based on a threshold condition.
  • Saturation: Clamps a dynamic signal to remain within lower and upper limits.