The select function, SEL, returns one of two values depending on the value of a boolean (BOOL) selector value.
Informal Syntax:
Formal Syntax:
SEL( G:=expression, IN0:=expression, IN1:=expression )
Parameter | Type | Description |
---|---|---|
G | BOOL | The selector value. |
IN0 | ANY | The value returned if G is FALSE. |
IN1 | ANY | The value returned if G is TRUE. |
If G is FALSE, SEL returns IN0.
If G is TRUE, SEL returns IN1.
The type of the return value is the "highest" type of the two inputs IN0 and IN1. For example if IN0 is type SINT and IN1 is type INT, the return type of the SEL function would be INT.
See Automatic Type Promotion for further information.
Example | Return Value |
---|---|
SEL( FALSE, 'Off', 'On') | STRING#'Off' |
SEL( TRUE, SINT#1, INT#5) | INT#5 |
SEL( G:=1, In0:=T#0s, In1:=T#10s) | TIME#10s |
IEC 61131-3 Second Edition: Table 27.1.
IEC 61131-3 Third Edition: Table 32.2.
To learn about other selection functions.
To learn about the different types supported by Fernhill SCADA.
To learn about other IEC 61131-3 Common Elements.
For the meaning of terms used in Fernhill SCADA.