SEL

Binary Selection.

OUT := SEL(G, IN0, IN1) 

means:

OUT := IN0 if G=FALSE;OUT := IN1 if G=TRUE.

IN0, IN1 and OUT can be any type of variable, G must be BOOL. The result of the selection is IN0 if G is FALSE, IN1 if G is TRUE.

Example in IL:

LD TRUE
SEL 3,4
ST Var1 (* Result is 4 *)

LD FALSE
SEL 3,4
ST Var1 (* Result is 3 *)

Example in FBD:

SEL 1:

SEL 2:

For the purpose of the run time optimization, one processes as follows: An expression, which is upstream IN0, is calculated only if G is FALSE. An expression of the IN1 is upstream, is calculated only if G is TRUE!