The LSCMP function block has two block calculations; the comparison calculation and the status propagation. Both are described here.
Comparison Calculation
The LSCMP function block compares the DISC_VAL input with the COMP_VAL1 input, the primary comparison value. Based on the relationship between DISC_VAL and COMP_VAL1, the LT, GT, EQ, and NEQ outputs are set to 0 (False) or 1 (True). A secondary comparison determines if DISC_VAL is within the range of COMP_VAL1 to COMP_VAL2. If DISC_VAL is within this range, then the IN_RANGE output is set to 1 (True), otherwise 0 (False).
Status Propagation
Bad status on any of the input values propagates to the output. If the DISC_VAL has a bad status, all outputs 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 LSCMP function block outputs based on different input values.
Parameter |
Example 1 |
Example 2 |
Example 3 |
|---|---|---|---|
DISC_VAL |
2.25 |
-233.0 |
37.5 |
COMP_VAL1 |
15.0 |
-200.0 |
37.5 |
COMP_VAL2 |
1.0 |
0.0 |
10.0 |
LT |
1 |
1 |
0 |
GT |
0 |
0 |
0 |
EQ |
0 |
0 |
1 |
NEQ |
1 |
1 |
0 |
IN_RANGE |
1 |
0 |
1 |