The function block is provided with 4 input pins - In1, In2, Onhyst, Offhyst and 1 output pin, Out. This function compares two inputs with each other and provides and output based on the comparison.
Note: It is possible to create invalid numbers by combining large values of input 2 and on and off hysteresis. The behavior is dependant on the operation selected, value of input 1, and the compiler. (That is, the simulator may have different behavior than the product.)
The following comparison calculations can be made using the Compare function block:
Additionally, on and off hysteresis analog inputs are provided which you can use to make compare calculations.
Note: The Output returns a zero value if no inputs are connected or if all inputs are invalid.
Inputs
| Range | ||||
| Input Name | Low | High | Input Value | Description |
| input1-2 | >=- infinity | <+ infinity | unconnected | out = 0 |
| invalid | out = 0 | |||
| onHyst | 0 | <+ infinity | unconnected | val = 0 |
| invalid | val = 0 | |||
| offHyst | 0 | <+ infinity | unconnected | val = 0 |
| invalid | val = 0 | |||
Setpoint
| Name | Range/Value | Description |
| Operation | Equals | The output is set to true if : (Input 2 - On Hyst) less than or equal to input 1 less than or equal to (Input 2 + Off Hyst) |
| Less Than | The output is set to true if : Input 1 less than (input 2 - on Hyst) The output does not change if : (Input 2 - on Hyst) less than or equal to input1 less than (Input 2 +off Hyst) The output is set to false if: Input1 greater than or equal to (Input 2 + off Hyst) |
|
| Greater Than | The output is set to true if : Input 1 greater than (input 2 + on Hyst) The output does not change if : (Input 2 - off Hyst) less than input1 less than or equal to (Input 2 + on Hyst) The output is set to false if: Input1 less than or equal to (Input 2 - off Hyst) |
Outputs
| Output Name | Range | Description |
| OUTPUT | False (0) or True (1) | Comparison of the inputs |
| If Property Negate is selected, the output is negated
after performing the logic. The sense of the hysteresis settings does not change. When negation is selected, the old output (from the previous cycle) is determined by negating the current value of the output. |