Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
21
Добавлен:
11.10.2020
Размер:
3.39 Mб
Скачать

The IEC Operators 297

Selection Operators

Example in FBD:

Example in IL:

LD 16#45

SHL 2

ST erg_byte

12.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.

12.5.1SEL

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

WAGO-I/O-SYSTEM 759 WAGO-I/O-PRO 32

298 The IEC Operators

Selection Operators

ST

Var1

(* Result ist

4

*)

LD

FALSE

 

 

 

SEL

3,4

 

 

 

ST

Var1

(* Result ist

3

*)

Example in ST:

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

Example in FBD:

Note:

Note that an expression occurring ahead of IN1 or IN2 will not be processed if IN0 is TRUE.

12.5.2MAX

Maximum function. Returns the greater of the two values.

OUT := MAX(IN0, IN1)

IN0, IN1 and OUT can be any type of variable.

Example in IL:

LD

90

MAX

30

MAX

40

MAX

77

ST

Var1 (* Result is 90 *)

Example in ST:

Var1:=MAX(30,40); (* Result is 40 *)

Var1:=MAX(40,MAX(90,30)); (* Result is 90 *)

Example in FBD:

WAGO-I/O-SYSTEM 759 WAGO-I/O-PRO 32

The IEC Operators 299

Selection Operators

12.5.3MIN

Minimum function. Returns the lesser of the two values.

OUT := MIN(IN0, IN1)

IN0, IN1 and OUT can be any type of variable.

Example in IL:

LD

90

MIN

30

MIN

40

MIN

77

ST

Var1 (* Result is 30 *)

Example in ST:

Var1:=MIN(90,30); (* Result is 30 *);

Var1:=MIN(MIN(90,30),40); (* Result is 30 *);

Example in FBD:

12.5.4LIMIT

Limiting

OUT := LIMIT(Min, IN, Max) means:

OUT := MIN (MAX (IN, Min), Max)

Max is the upper and Min the lower limit for the result. Should the value IN exceed the upper limit Max, LIMIT will return Max. Should IN fall below Min, the result will be Min.

IN and OUT can be any type of variable.

Example in IL:

LD 90

LIMIT 30,80

ST

Var1 (*Result is 80 *)

WAGO-I/O-SYSTEM 759 WAGO-I/O-PRO 32

Соседние файлы в папке 759-332