L_USPP_Compare
This function block compares two signals of the "LREAL" data type and can for instance be used to implement a trigger.
The comparison operation is selected via the dwFunction input.
|
|
|
|
L_USPP_Compare |
|
|
|
|
|---|---|---|---|---|---|---|---|
|
LREAL |
- |
|
lrIn1 |
xOut |
|
- |
BOOL |
|
LREAL |
- |
|
lrIn2 |
xError |
|
- |
BOOL |
|
DWORD |
- |
|
dwFunction |
eErrorID |
|
- |
L_IE1P_Error |
|
LREAL |
- |
|
lrTolerance |
|
|
|
|
|
LREAL |
- |
|
lrHysteresis |
|
|
|
|
|
|
|
|
|
|
|
|
|
Inputs
|
Name Data type |
Information/possible settings |
|
|---|---|---|
|
lrIn1 LREAL |
Input signal 1 |
|
|
lrIn2 LREAL |
Input signal 2 |
|
|
dwFunction DWORD |
Comparison operation |
|
|
0 |
lrIn1 = lrIn2 (initialisation) |
|
|
1 |
lrIn1 > lrIn2 |
|
|
2 |
lrIn1 < lrIn2 |
|
|
3 |
|lrIn1| = |lrIn2| |
|
|
4 |
|lrIn1| > |lrIn2| |
|
|
5 |
|lrIn1| < |lrIn2| |
|
|
lrTolerance LREAL |
Window for comparison operation
|
|
|
lrHysteresis LREAL |
Hysteresis for comparison operation
|
|
Outputs
|
Name Data type |
Value/meaning |
|
|---|---|---|
|
xOut BOOL |
TRUE |
The statement of the selected comparison mode is true. |
|
xError BOOL |
TRUE |
An error has occurred. For details see eErrorID . |
|
eErrorID L_IE1P_Error |
If xError = TRUE: Error number for the error that has occurred.
|
|
Comparison operation "lrIn1 = lrIn2"
- Selection: dwFunction = 0
- This function compares two signals with regard to equality. It can, for instance, provide the comparison "actual speed equals setpoint speed" (n act = n set ).
- Use the input lrTolerance to select the window within which the equality is to apply.
- Use the lrHysteresis input to select a hysteresis if the input signals are not stable and the output is therefore oscillating.
|
Switching performance lrIn1 = lrIn2
With this function, use the FB in a fast task to achieve optimum sampling of the signals.
|
Example lrIn1 = lrIn2
Comparison operation "lrIn1 > lrIn2"
- Selection: dwFunction = 1
- This function serves, for instance, to implement the comparison "actual speed is higher than a limit value" (n act > n x ) for one direction of rotation.
|
Switching performance lrIn1 > lrIn2
Function sequence:
- If the value at lrIn1 exceeds the value at lrIn2 , xOut changes from FALSE to TRUE.
- Only when the signal at lrIn1 falls below the value of lrIn2 - lrHysteresis again, xOut changes back from TRUE to FALSE.
|
Example lrIn1 > lrIn2
Comparison operation "lrIn1 < lrIn2"
- Selection: dwFunction = 2
- This function serves, for instance, to implement the comparison "actual speed is lower than a limit value" (n act < n x ) for one direction of rotation.
|
Switching performance lrIn1 < lrIn2
Function sequence:
- 1. If the value at lrIn1 falls below the value at lrIn2 , xOut changes from FALSE to TRUE.
- Only when the signal at lrIn1 exceeds the value of lrIn2 - lrHysteresis again xOut changes back from TRUE to FALSE.
|
Example lrIn1 < lrIn2
Comparison operation |lrIn1| = |lrIn2|
- Selection: dwFunction = 3
- This function serves, for instance, to implement the comparison "actual speed equals zero" (n act = 0).
- This function behaves just like the "lrIn1 = lrIn2" comparison operation; however, the amount is generated by the input signals before signal processing (without sign).
Comparison operation |lrIn1| > |lrIn2|
- Selection: dwFunction = 4
- This function serves, for instance, to implement the comparison "actual speed is higher than a limit value" (|n act | > |n x |), irrespective of the direction of rotation.
- This function behaves just like the "lrIn1 > lrIn2" comparison operation; however, the amount is generated by the input signals before signal processing (without sign).
Comparison operation |lrIn1| < |lrIn2|
- Selection: dwFunction = 5
- This function serves, for instance, to implement the comparison "actual speed is lower than a limit value" (|n act | < |n x |), irrespective of the direction of rotation.
- This function behaves just like the "lrIn1 < lrIn2" comparison operation; however, the amount is generated by the input signals before signal processing (without sign).