Attention
IronPLC can only run very simple programs. The steps described are accurate but many language features are not yet supported.
SEL¶
Binary selection — selects one of two inputs based on a Boolean selector.
IEC 61131-3 |
Section 2.5.1.5.5 |
Support |
Supported |
Signatures¶
# |
Input (G) |
Input (IN0) |
Input (IN1) |
Return Type |
Support |
|---|---|---|---|---|---|
1 |
|
ANY |
ANY |
ANY |
Supported |
Description¶
SEL(G, IN0, IN1) returns IN0 if G is FALSE, or IN1 if
G is TRUE. The types of IN0 and IN1 must be the same, and
the return type matches the input type.
This function is polymorphic: it works with any data type for the selected inputs.
Example¶
result := SEL(TRUE, 10, 20); (* result = 20 *)
result := SEL(FALSE, 10, 20); (* result = 10 *)
flag := SEL(cond, FALSE, TRUE); (* conditional Boolean *)