3 formula processor, 1 arithmetic operations, Formula processor – Lenze ETC Motion Control User Manual
Page 172: Arithmetic operations, Cnc programming
CNC programming
Formula processor
Arithmetic operations
3.3
3.3.1
l
172
EDSTCXN EN 2.0
3.3
Formula processor
In the NC program, in addition to programming via G functions, it is also
possible to input mathematical formula directly. A mathematical expression
is indicated by a ":" at the beginning of the line. This can be preceded by a
block number. Comments are allowed in a block with a mathematical
expression when included in curly brackets "{}".
The formula processor can also be used to calculate complex expressions for
the control at runtime. Both constants and elements from the parameter
field can be used as operands and combined in any way. The arithmetic
operations are indicated by agreed operations. The use of brackets is
allowed.
3.3.1
Arithmetic operations
Syntax
Operation
Description
x + y
x + y
Addition
x − y
x – y
Subtraction
x * y
xy
Multiplication
x / y
x / y
Division
x ^ y
x
y
Power
SQR(x)
x
2
Square of a number
SQRT(x)
x
Square root of a number
HYPOT(x,y)
2
2
Y
x
+
Amount of a vector in the plane
HYPOT3(x,y,z)
2
2
2
Z
Y
X
+
+
Amount of a vector in the space
FMOD(x,y)
rest(x/y)
Remaining amount from division x / y
SIN(x)
sinx
Sinus of an angle in degrees
COS(x)
cosx
Cosinus of an angle in degrees
TAN(x)
tanx
Tangent of an angle in degrees
ASIN(x)
arcsinx
Arc sine, delivers an angle between −90
°
and +90
°
ACOS(x)
arccosx
Arc cosine, delivers an angle between 0
°
and 180
°
ATAN(x)
arctanx
Arc tangent, delivers an angle between −90
°
and +90
°
ATAN2(y,x)
arctan(y/x)
Arc tangent with two arguments, delivers an angle
between 0
°
and 360
°
MOD360(x)
rest (x/360)
Angle x modulo 360
°
ABS(x)
|x|
Absolute value of a number (without sign)
SIGN(x)
x/
.
x
.
Sign of a number; +1 for x >= 0 and −1 for x < 0
ROUND(x)
roundx
Round up or down a number to integer values
TRUNC(x)
truncx
Delivers the positions before the decimal point of a
number
FRAC(x)
x−truncx
Delivers the positions after the decimal point of a
number
MIN(x,y)
min{x,y}
Delivers the smaller value
MAX(x,y)
max{x,y}
Delivers the larger value
RANDOM(x,y)
rand
Delivers random numbers between x and y