The Comparator function block has two block calculations; the comparison calculation and the status propogation. Both are described here.
Comparison calculation
The Comparator function block takes the DISC_VAL input and performs a compare operation with COMP_VAL1, the primary comparison value. Based on the relationship between DISC_VAL and COMP_VAL1, the LT, GT, EQ, NEQ outputs will be set to 0 (False) or 1 (True). A secondary comparison is done to verify if the DISC_VAL is within the range of COMP_VAL1 to COMP_VAL2. If DISC_VAL is within this range, then the IN_RANGE output will be set to 1 (True), otherwise 0 (False).
Status propagation
Bad status on any of the input values is propagated to the output. If the DISC_VAL has a Bad status, all outputs will reflect this bad status. If DISC_VAL has Good status but COMP_VAL1 or COMP_VAL2 has Bad status, then the outputs associated with the bad input are also set to Bad. The status calculation is totally independent of the comparison calculations.
The following table shows an example of the Comparator function block outputs based on different input values.