Project

General

Profile

Compare Input » History » Revision 4

Revision 3 (Adam Klama, 05/06/2025 02:37 PM) → Revision 4/5 (Adam Klama, 05/06/2025 02:38 PM)

# **Compare Input** Input Description** 

 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. 

 --- 

 ## **1. Input Source** 

 The user can select a signal from available system variables (e.g., coolant temperature, pressure, RPM) to use as the input for comparison. 

 --- 

 ## **2. Comparison Modes** 

 Specifies how the input is evaluated relative to a defined `Value`. 

 - ### **Equal** 
   - Output is `true` only when the input equals the specified `Value`. 
   - `Deviation` is **forced to 0** in this mode — no hysteresis or tolerance is applied. 
   - Ideal for detecting exact matches. 

 - ### **Window Compare** 
   - Output is `true` when the input is within the range: 
     ``` 
     Value - Deviation ≤ Input ≤ Value + Deviation 
     ``` 
   - Output is `false` when the input is outside this range. 
   - Useful for checking valid or safe operating windows. 

 - ### **LessThan** 
   - Output turns `true` when: 
     ``` 
     Input < Value - Deviation 
     ``` 
   - Output turns `false` when: 
     ``` 
     Input > Value + Deviation 
     ``` 

 - ### **GreaterThan** 
   - Output turns `true` when: 
     ``` 
     Input > Value + Deviation 
     ``` 
   - Output turns `false` when: 
     ``` 
     Input < Value - Deviation 
     ``` 

   > These hysteresis thresholds prevent output toggling due to small signal oscillations. 

 --- 

 ## **3. Value** 

 The central threshold used in all comparison modes. 

 --- 

 ## **4. Deviation** 

 Defines the hysteresis band or tolerance around the `Value`. 

 - Used in **Window Compare**, **LessThan**, and **GreaterThan** modes. 
 - Helps filter out signal noise or rapid transitions. 
 - **Not used in Equal mode** (automatically set to 0). 

 --- 

 ## **5. Filter Enable** 

 Controls how the input signal is processed and whether timing constraints are applied. 

 - ### **Filter Disabled** 
   - Compare Input operates in **level-based mode**. 
   - Output reacts **immediately** to input crossing thresholds. 
   - **Delay** and **Cooldown** are **ignored**. 

 - ### **Filter Enabled** 
   - Compare Input operates in **event-based mode**. 
   - Output is triggered on **rising/falling transitions** of the condition. 
   - **Delay** and **Cooldown** become active: 
     - `Delay`: suppresses short glitches. 
     - `Cooldown`: prevents rapid retriggering. 

 --- 

 ## **6. Delay** 

 - Only evaluated when **Filter is enabled**. 
 - The input condition must remain valid continuously for the full **Delay time** before the output is activated. 

 --- 

 ## **7. Cooldown** 

 - Only evaluated when **Filter is enabled**. 
 - Defines the **minimum time after the end of the trigger condition** during which new events are ignored. 
 - Prevents repeated or bouncing events immediately after a trigger ends. 

 --- 

 ## **Example Configuration** 

 ```text 
 Input:            Coolant Temperature 
 Mode:             LessThan 
 Value:            80 
 Deviation:        3 
 Filter:           Enabled 
 Delay:            50 ms 
 Cooldown:         200 ms 
 ``` 

 ### **Behavior** 
 - Output turns **on** when the input drops below **77°C** and stays there for **at least 50 ms**. 
 - Output turns **off** when the input rises above **83°C**. 
 - After turning off, the system **waits 200 ms** before allowing another trigger.