powered by CADENAS

Manual

Manual

6.8.5.1. Mathematical functions (Attribute algorithm)

[Note] Note

Functions may occur in conditions and allocations of numerical variables.

Example condition:

IF (L1.LT.SQRT(25)) THEN ...

Examples Allocation of numerical variables:

D3=LOGL1

A=(B+5)*3-10/2

C=SQRT(A**2+B**2)

Conditions

IF (....) ...

IF () THEN
  VAR = 
ELSE
  VAr = 
ENDIF

ELSEIF (....) ...

IF () THEN
  VAR = 
ELSE

Logical operators:
  • Comparison

    .EQ.

    eq ual

    .GT.

    g reater t han

    .GE.

    greater than or e qual

    .LT.

    l ess t han

    .LE.

    less than or e qual

  • Linking

    .AND.

    (both conditions - to the right and left of .AND. - must be met)

    .OR.

    (one of the two conditions - to the right or left of .OR. - must be met)

    .NE.

    n ot e qual

Basic arithmetic operations

+, -, *, /

Basic arithmetic operations

**

Exponentiation

Mathematical functions

number = ABS (number)

Absolute value:

Example:

|-3.4| = 3.4

number = AINT (number)

Truncate non-integral number range

Example:

AINT(3.1) = 3
AINT(3.9) = 3
AINT(-3.9) = -3

number = ANINT (number)

Next real integer (rounding)

Example:

ANINT(3.1) = 3
ANINT(3.9) = 4
ANINT(-3.9) = -4

number = DIM (number,number)

Positive difference:

As long as the first number is bigger than the second, the calculation is: number 1 - number 2; otherwise the result is 0.

Example:

DIM(8,4) = 4
DIN(4,8) = 0

number = SQRT (number)

Square route

number = EXP (number)

Exponential function

number = INT (number)

Cutting the decimal places

Example:

INT(4,9) = 4

number = NINT (number)

Rounding

Example:

NINT(4.9) = 5
NINT(4.5) = 5
NINT(4.1) = 4

number = LOG (number)

Natural logarithm

number = LOG10 (number)

Logarithm base 10

number = MAX (...)

MAX (A1, A2, A3,…) 

Maximum value of parameters

number = MIN (...)

MAX (A1, A2, A3,…) 

Minimum value of parameters

number = MOD (number,number)

Remainder calculation:

A – INT (A/P)*P

Example

MOD(11,4) = 3
11 - (INT(11/4)*4) = 11 - 2*4 = 3
11 / 4 == 2 Rest 3

number = SIGN (number,number)

Sign transfer: |A| signum (B)

SIGN(A,B) means that the return of the value of A is given with the prefix of B.

Example:

SIGN(10,1)   =  10
SIGN(10,-1)  = -10

SIGN(-10,1)  =  10
SIGN(-10,-1) = -10

Angular functions

number = SIN (number)

Sine

number = SINH (number)

Hyperbolic sine

number = COS (number)

Cosine

number = COSH (number)

Hyperbolic cosine

number = TAN(number)

Tangent

number = TANH(number)

Cosine tangent

number = ASIN (number)

Arc sine

number = ACOS (number)

Arc cosine

number = ATAN (number)

Arc tangent

number = ATAN2 (number,number)

Arc tangent with two arguments

The result is returned in degree.

[Note] Note

At angular functions the entry in brackets mirrors the degree value.

Text-related functions:

number = ATOF ('text')

Changes text to number:

Example:

ATOF ('3.2') -> 3.2

LEN ('text')

LEN (Variable)

Length of text:

LEN('abcd')  = 4
LEN(VAR)  = Länge des Textes in der Variable VAR
text = SUBSTR (text,number,number)

Section from text

The first parameter is the text, the second indicates at which symbol the extract begins, and the third parameter indicates the length of the extract.

Example:

SUBSTR('Hallo Welt',1,5) -> Hello
SUBSTR('Hallo Welt',7,4) -> World

[Note] Note

The following functions can not be used: FORMATSTR, FORMATVAL, KFIX

Thread functions

text = GETTHREADTEXT (number,text,text,number)

Used with threads:

Using the following expression you can generate different output.

Example:

NAME  =  GETTHREADTEXT(D,'DIN 13','',P,'NAME')

A detailed description can be found under Section 6.9.3.11.1.1.2, “Fine thread - variants ”.

number = GETTHREADVALUE (number,text,text,number)

Compare the preceding function

GETTHREADTEXT gets a text from the table and GETTHREADVALUE a DOUBLE value.

Translation functions

text = TRANSLATE ('text')

text = TRANSLATE ($VARIABLENNAME.)

text = $VARIABLENNAME(SRC=VALDESC).

See Section 6.8.5.2, “ Translation functions”.