Selection operators, L-force | plc designer – Lenze PLC Designer PLC Designer (R2-x) User Manual

Page 476

Advertising
background image

L-force | PLC Designer

IEC Operators and additional norm extending functions

474

DMS 3.2 EN 02/2011 TD29



9.5

Selection Operators

All selection operations can also be performed with variables. For purposes of clarity
we will limit our examples to the following which use constants as operators.

9.5.1

SEL

PLC Designer IEC operator: 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 (* IN0 = 3, IN1 =4 *)

ST Var1 (* Result is 4 *)

LD FALSE

SEL 3,4

ST Var1 (* Result is 3 *)

Example in ST:

Var1:=SEL(TRUE,3,4); (* Result is 4 *)

Advertising