If('Condition','Expression1','Expression2')
Arguments
|
'Condition' |
Condition as an operation with the Boolean results, TRUE or FALSE |
|
|
'Expression1' |
Operation is performed if 'Condition' is TRUE |
|
|
'Expression2' |
Operation is performed if 'Condition' is FALSE |
Description
The If-function can be used for a conditioned execution of further calculations. Depending on the Boolean result of a 'Condition’, which can itself be an operation, the operation ‘Expression1’ will be executed if the result is TRUE and the operation ‘Expression2’ if the result is FALSE.
In conclusion, different process-controlled calculations can be performed. You can use this function of course in an interlaced form to realize further branches. Text signals are supported.
Tip |
|
|---|---|
|
If only one value is entered for 'Condition', as a condition it will be checked whether the value is greater than (TRUE) or less than (FALSE) 0.5. |
|
Note |
|
|---|---|
|
Instead of "If" function you may use the "Switch" function. Moreover, the "Switch" function offers the advantage to configure more than two cases. |
|
Example
Detecting when a measurement signal is over a set limit
Solution
The limit is formulated in 'Condition' as a condition with logical operands. If 'Condition' is TRUE, the value of 4 is returned, if FALSE then the value of 1.
In the figure below the condition is met above the dotted line (marked in green). Below the dotted line the condition is not met.
