Previous Icon 3

Next Icon 3

Calculation variables

You cannot define your own variables (apart from the number variables used for FOR loops, which you (as the user) specify, and which can output a value.

Placeholder

Use placeholders to specify the file type and formatting for a variable:

The data types must match the definition in the program. The value is returned in exactly the place where the placeholder is positioned. The syntax of the formatting corresponds to the C/C++ standard.

 

Examples

 

Counter-examples

 

Variables

The variable to be displayed must stand after the placeholder in the same row. The variable is identified by being enclosed in curly brackets. If these brackets are left out, the variable name will appear as normal text.

Important: It is essential that the number of placeholders exactly matches the number of pairs of brackets {}.

 

Example

%f {sheave[0].d} returns the value of the variable sheave[0].d in the location %f as a floating point number with 6 decimal places.

 

Basic calculation types - output of changed variables

You can output changed variables in the report. They can be multiplied or divided with a coefficient. You can also add or subtract a number. This functionality is also available in the arguments used in the IF or FOR statements (see below).

Value of the variable multiplied

%3.2f

{Var*2.0}

Value of the variable divided

%3.2f

{Var/2.0}

Value of the variable added

%3.2f

{Var+1.0}

Value of the variable subtracted

%3.2f

{Var-2}

The two Degree and Gear functions are also available for converting variables to degrees or radians:

Angle %3.2f {grad(angle)}

Variables can also be directly linked with each other, e.g. in the form {sheave[0].d- sheave[1].d}. More than two numbers can be linked. Numbers that have sign operators must be enclosed in brackets, for example {ZR[0].NL*(1e-6)}.

The available functions are listed in Table 8.2.

Function

Meaning

sin(angle)

sine of angle in the radian measure

cos(angle)

cosine of angle in the radian measure

tan(angle)

tangent of angle in the radian measure

asin(val)

arcsine of val, returns radian measure

acos(val)

arccosine of val, returns radian measure

atan(val)

arctangent of val, returns radian measure

abs(val)

|val|

exp(val)

eval

log(val)

Return value x in ex = val

log10(val)

Return value x in 10x = val

sqr(val)

Return value val2

sqrt(val)

Return value

int(val)

Whole number of val

pow(x;y)

Return value xy

sgn(val)

Return value

sgn2(val)

Return value

grad(angle)

Converting from the radian measure to degrees

rad(angle)

Converting from degrees to radian measure

mm_in(val)

Return value val/25.4

celsius_f(val)

Return value val + 32

min(ν1; ...; ν5)

The return value is the minimum of ν1,...,ν5

max(ν1; ...; ν5)

The return value is the maximum of ν1,...,ν5

and(ν1; ν2)

binary and function

or(ν1; ν2)

binary or function

xor(ν1; ν2)

binary exclusive or function

AND(ν1; ...; ν5)

logical and function

OR(ν1; ...,ν5)

logical or function

NOT(val)

Return value

LESS(ν1; ν2)

Return value

EQUAL(ν1; ν2)

Return value

GREATER(ν1; ν2)

Return value

ROUND(x;n)

Rounds off x to n places

strlen(str)

Length of character string

strcmp(str1;str2)

Compare character string

Return value:

1 if str1 = str2

0 otherwise

Table 8.2: Functions available for calculations in the report