Project

General

Profile

Compare Input » History » Version 4

Adam Klama, 05/06/2025 02:38 PM

1 4 Adam Klama
# **Compare Input**
2 1 Adam Klama
3 3 Adam Klama
The **Compare Input** block evaluates a selectable system signal against a user-defined threshold using flexible comparison logic. It supports hysteresis, optional filtering, and timing control for stable and precise event detection.
4 1 Adam Klama
5 3 Adam Klama
---
6 1 Adam Klama
7 3 Adam Klama
## **1. Input Source**
8 1 Adam Klama
9 3 Adam Klama
The user can select a signal from available system variables (e.g., coolant temperature, pressure, RPM) to use as the input for comparison.
10 1 Adam Klama
11 3 Adam Klama
---
12 1 Adam Klama
13 3 Adam Klama
## **2. Comparison Modes**
14 1 Adam Klama
15 3 Adam Klama
Specifies how the input is evaluated relative to a defined `Value`.
16 1 Adam Klama
17 3 Adam Klama
- ### **Equal**
18
  - Output is `true` only when the input equals the specified `Value`.
19
  - `Deviation` is **forced to 0** in this mode — no hysteresis or tolerance is applied.
20
  - Ideal for detecting exact matches.
21 1 Adam Klama
22 3 Adam Klama
- ### **Window Compare**
23
  - Output is `true` when the input is within the range:
24
    ```
25
    Value - Deviation ≤ Input ≤ Value + Deviation
26
    ```
27
  - Output is `false` when the input is outside this range.
28
  - Useful for checking valid or safe operating windows.
29 1 Adam Klama
30 3 Adam Klama
- ### **LessThan**
31
  - Output turns `true` when:
32
    ```
33
    Input < Value - Deviation
34
    ```
35
  - Output turns `false` when:
36
    ```
37
    Input > Value + Deviation
38
    ```
39 1 Adam Klama
40 3 Adam Klama
- ### **GreaterThan**
41
  - Output turns `true` when:
42
    ```
43
    Input > Value + Deviation
44
    ```
45
  - Output turns `false` when:
46
    ```
47
    Input < Value - Deviation
48
    ```
49 1 Adam Klama
50 3 Adam Klama
  > These hysteresis thresholds prevent output toggling due to small signal oscillations.
51 1 Adam Klama
52 3 Adam Klama
---
53 1 Adam Klama
54 3 Adam Klama
## **3. Value**
55 1 Adam Klama
56 3 Adam Klama
The central threshold used in all comparison modes.
57 1 Adam Klama
58 3 Adam Klama
---
59 1 Adam Klama
60 3 Adam Klama
## **4. Deviation**
61 1 Adam Klama
62 3 Adam Klama
Defines the hysteresis band or tolerance around the `Value`.
63 1 Adam Klama
64 3 Adam Klama
- Used in **Window Compare**, **LessThan**, and **GreaterThan** modes.
65
- Helps filter out signal noise or rapid transitions.
66
- **Not used in Equal mode** (automatically set to 0).
67 1 Adam Klama
68 3 Adam Klama
---
69 1 Adam Klama
70 3 Adam Klama
## **5. Filter Enable**
71 1 Adam Klama
72 3 Adam Klama
Controls how the input signal is processed and whether timing constraints are applied.
73 1 Adam Klama
74 3 Adam Klama
- ### **Filter Disabled**
75
  - Compare Input operates in **level-based mode**.
76
  - Output reacts **immediately** to input crossing thresholds.
77
  - **Delay** and **Cooldown** are **ignored**.
78 1 Adam Klama
79 3 Adam Klama
- ### **Filter Enabled**
80
  - Compare Input operates in **event-based mode**.
81
  - Output is triggered on **rising/falling transitions** of the condition.
82
  - **Delay** and **Cooldown** become active:
83
    - `Delay`: suppresses short glitches.
84
    - `Cooldown`: prevents rapid retriggering.
85 1 Adam Klama
86 3 Adam Klama
---
87 1 Adam Klama
88 3 Adam Klama
## **6. Delay**
89 1 Adam Klama
90 3 Adam Klama
- Only evaluated when **Filter is enabled**.
91
- The input condition must remain valid continuously for the full **Delay time** before the output is activated.
92 1 Adam Klama
93 3 Adam Klama
---
94 1 Adam Klama
95 3 Adam Klama
## **7. Cooldown**
96 1 Adam Klama
97 3 Adam Klama
- Only evaluated when **Filter is enabled**.
98
- Defines the **minimum time after the end of the trigger condition** during which new events are ignored.
99
- Prevents repeated or bouncing events immediately after a trigger ends.
100 1 Adam Klama
101 3 Adam Klama
---
102 1 Adam Klama
103 3 Adam Klama
## **Example Configuration**
104 1 Adam Klama
105 3 Adam Klama
```text
106
Input:          Coolant Temperature
107
Mode:           LessThan
108
Value:          80
109
Deviation:      3
110
Filter:         Enabled
111
Delay:          50 ms
112
Cooldown:       200 ms
113
```
114 1 Adam Klama
115 3 Adam Klama
### **Behavior**
116
- Output turns **on** when the input drops below **77°C** and stays there for **at least 50 ms**.
117
- Output turns **off** when the input rises above **83°C**.
118
- After turning off, the system **waits 200 ms** before allowing another trigger.