Материал: m912201e

Внимание! Если размещение файла нарушает Ваши авторские права, то обязательно сообщите нам

314 The IEC Operators

Numeric Functions

12.10.6SIN

Returns the sine of a number.

IN can be type BYTE, WORD, DWORD, INT, DINT, REAL, SINT, USINT, UINT, UDINT, OUT must be type REAL.

Example in IL:

LD 0.5

SIN

ST

q

(*Result is 0.479426 *)

Example in ST:

q:=SIN(0.5);

Example in FBD:

12.10.7COS

Returns the cosine of number. The value is calculated in arch minutes.

IN can be type BYTE, WORD, DWORD, INT, DINT, REAL, SINT, USINT, UINT, UDINT, OUT must be type Typ REAL.

Example in IL:

LD 0.5

COS

ST

q

(*Result is 0.877583 *)

Example in ST:

q:=COS(0.5);

Example in FBD:

12.10.8TAN

Returns the tangent of a number. The value is calculated in arch minutes. IN can be type BYTE, WORD, DWORD, INT, DINT, REAL, SINT, USINT, UINT, UDINT, OUT must be type REAL.

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

The IEC Operators

315

Numeric Functions

 

 

 

Example in IL:

LD 0.5

TAN

ST

q

(*Result is 0.546302 *)

Example in ST:

q:=TAN(0.5);

Example in FBD:

12.10.9ASIN

Returns the arc sine (inverse function of sine) of a number. .

IN can be type BYTE, WORD, DWORD, INT, DINT, REAL, SINT, USINT, UINT, UDINT, OUT must be type REAL.

Example in IL:

LD 0.5

ASIN

ST

q

(*Result is 0.523599 *)

Example in ST:

q:=ASIN(0.5);

Example in FBD:

12.10.10ACOS

Returns the arc cosine (inverse function of cosine) of a number. The value is calculated in arch minutes.

IN can be type BYTE, WORD, DWORD, INT, DINT, REAL, SINT, USINT, UINT, UDINT, OUT must be type REAL.

Example in IL:

LD 0.5

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

316 The IEC Operators

Numeric Functions

ACOS

ST

q

(*Result is 1.0472 *)

Example in ST:

q:=ACOS(0.5);

Example in FBD:

12.10.11ATAN

Returns the arc tangent (inverse function of tangent) of a number. The value is calculated in arch minutes.

IN can be type BYTE, WORD, DWORD, INT, DINT, REAL, SINT, USINT, UINT, UDINT, OUT must be type REAL.

Example in IL:

LD 0.5

ATAN

ST

q

(*Result is 0.463648 *)

Example in ST:

q:=ATAN(0.5);

Example in FBD:

12.10.12EXPT

Exponentiation of a variable with another variable:

OUT = IN1IN2.

IN1 and IN2 can be type BYTE, WORD, DWORD, INT, DINT, REAL,

SINT, USINT, UINT, UDINT, OUT must be type REAL.

Example in IL:

LD 7

EXPT 2

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

The IEC Operators

317

Numeric Functions

 

 

 

ST

var1 (*Result is 49 *)

Example in ST:

var1 := EXPT(7,2);

Example in FBD:

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

318 Standard Library Elements

String functions

13Standard Library Elements

13.1 String functions

Note:

String functions are not "thread safe": When using tasks, string functions may only be used in a single task. If the same function is used in different tasks, there is a danger of overwriting.

13.1.1LEN

Returns the length of a string. Input STR is of type STRING, the return value of the function is type INT.

Example in IL:

LD 'SUSI'

LEN

ST

VarINT1

(* Ergebnis ist 4 *)

Example in FBD:

Example in ST:

VarSTRING1 := LEN ('SUSI');

Note:

String functions are not "thread safe"

13.1.2LEFT

Left returns the left, initial string for a given string. Input STR is type

STRING, SIZE is of type INT, the return value of the function is type

STRING.

LEFT (STR, SIZE) means: Take the first SIZE character from the right in the string STR.

Example in IL:

LD 'SUSI'

LEFT 3

ST

VarSTRING1 (* Ergebnis ist 'SUS' *)

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