Skip to main content

FB_COMPARE

Description Function Block

The FB_COMPARE function block checks that the 2–5 analog inputs CompIn1 to CompIn5 are equal within a window of tolerance based on time and value. The b1oo2, b2oo3, and b3oo5 inputs are used to specify the number of inputs to be evaluated. The udiAllowedDeviation and tToleranceTime (ms) inputs specify the deviations and the time interval permitted between the input values. The bIsValid output returns a logic 1 if the comparison results in a positive value.

The CompOut output contains the 1st analog value which meets the comparison criteria.

The ERROR state is entered if an overflow or underflow occurs. Then the CompOut and bIsValid outputs are set to 0 and the bError output is set to 1.

EL6900

The FB_COMPARE function block is not supported by the EL6900.

EL6900_COMPARE.png
Table 36. VAR_INPUT

Name

Data Type

Initial Value

Description, Parameter Values

CompIn1

LINT

0

1st analog signal for the comparison (1oo2, 2oo3, 3oo5)

Permitted data types: UINT, INT, UDINT, DINT

CompIn2

LINT

0

2nd analog signal for the comparison (1oo2, 2oo3, 3oo5)

Permitted data types: UINT, INT, UDINT, DINT

CompIn3

LINT

0

3rd analog signal for the comparison (2oo3, 3oo5)

Permitted data types: UINT, INT, UDINT, DINT

CompIn4

LINT

0

4th analog signal for the comparison (3oo5)

Permitted data types: UINT, INT, UDINT, DINT

CompIn5

LINT

0

5th analog signal for the comparison (3oo5)

Permitted data types: UINT, INT, UDINT, DINT

b1oo2

SAFEBOOL

FALSE

Comparison mode 1oo2: Only the first two inputs CompIn1 and CompIn2 are active. If both inputs are equal (within the permitted deviation), then the first input CompIn1 is written to the CompOut output. In case of an error, the CompOut output is switched off and the bIsValid output is reset.

Only a constant value is permitted (no variable).

Only one of the b1oo2, b2oo3, and b3oo5 inputs may beTRUE.

b2oo3

SAFEBOOL

FALSE

Comparison mode 2oo3: Only the first three inputs CompIn1, CompIn2, and CompIn3 are active. If at least two inputs are equal (within the permitted deviation), then the first input with the valid value is written to the CompOut output. In case of an error, the CompOut output is switched off and the bIsValid output is reset.

Only a constant value is permitted (no variable)

Only one of the b1oo2, b2oo3, and b3oo5 inputs may beTRUE.

b3oo5

SAFEBOOL

FALSE

Comparison mode 3oo5: All five inputs CompIn1, CompIn2, CompIn3, CompIn4, and CompIn5 are active. If at least three inputs are equal (within the permitted deviation), then the first input with the valid value is written to the CompOut output. In case of an error, the CompOut output is switched off and the bIsValid output is reset.

Only a constant value is permitted (no variable)

Only one of the b1oo2, b2oo3, and b3oo5 inputs may beTRUE.

udiAllowedDeviation

SAFEUDINT

0

Permitted deviation when comparing the inputs

Only a constant value is permitted (no variable)

tToleranceTime

SAFETIME

TIME#0ms

Time frame (in ms) within which unequal values are tolerated.

Only a constant value is permitted (no variable)



Table 37. VAR_OUTPUT

Name

Data Type

Initial Value

Description, Parameter Values

bIsValid

SAFEBOOL

FALSE

TRUE: The values are equal (within the permitted deviation).

CompOut

SAFEUSINT

0

Output value: Corresponds to the first CompIn input value which fulfills the comparison.

Permitted data types: UINT, INT, UDINT, DINT. The data type must be selected according to the input data types.

bError

SAFEUSINT

0

TRUE: The CompOut output has an overflow or underflow.

FALSE: No error has occurred.