CalculatorTool

Calculations or logical queries can be performed with the CalculatorTool. In contrast to C# or VB scripts, no programming knowledge is required here.

../../../_images/calculatorTool.png

Inputs

The inputs can be added as a terminal by dragging and dropping them onto the tool. The following data types are supported:

System.Int32
System.Double
System.Boolean
System.Int32[]
System.Double[]
System.VisionPro.CogToolResultConstant

Alternatively, inputs can be defined in the Tool Editor:

../../../_images/calculatorTool-inputs.png
  1. Plus symbol: Manually add an input terminal

  2. Minus symbol: Remove the selected input terminal

  3. Arrow up/down: Change sort order

  4. Name: Name of the input terminal

  5. Abbreviation: Abbreviation of the name that can be used as an alternative to the name in the ouput formulas.

  6. Value: Current value of the terminal

  7. Type: Data type of the terminal

Outputs

The results of the tool are created under “Outputs”. Both intermediate results without an output terminal and final results with an output terminal can be defined.

../../../_images/calculatorTool-outputs.png
  1. Plus symbol: Manually add an output

  2. Minus symbol: Remove the selected output

  3. Arrow up/down: Change the sort order.

  4. Name: Name of the output

  5. Formula: Enter a formula for calculating the output value (see below).

  6. Type: Data type of the output

  7. Value: Current value of the output

  8. IsTerminal: A terminal is to be created for the output.

Warning

The outputs are calculated in the sort order. When sorting, please note that intermediate results must be determined before the first use.

Enter the formula

The formulas for calculating the output values are specified in the “Formula” field. Via the context menu (right-click on the “Formula” field) all possible operators, constants and functions are listed and can be selected:

../../../_images/calculatorTool-menu.png

In addition, all inputs (with the name entered under “Abbreviation”) are available. Outputs calculated before the current value can also be used.

Example of inputs

../../../_images/calculatorTool-inputs-example.png

Example of outputs

../../../_images/calculatorTool-outputs-example.png

Hint

  1. The decimal separator is a period in all fields.

  2. Passing parameters of functions are separated with commas.

  3. Spaces between operators are ignored.

  4. Several functions can be nested within each other.

  5. It is possible to convert between data types, i.e. to assign a different data type to an output than the expected result. It should be noted that, for example, when converting from double to integer, the decimal places are truncated and not rounded!

  6. With an If condition, three parameters must be passed. The first represents the condition, the second the value if the condition is true and the third the value if the condition is not true.

Available Constants, Operators, Functions

Constant

Description

e

Euler’s number

pi

circular number Pi

In addition, all inputs (via the shortcut) and the outputs are available above the current entry.

Operator

Description

+

Add, positive sign

-

Subtract, negative sign

(

Open bracket

)

Closed bracket

*

Multiply

/

Divide

^

XOR operator

!=

Unbalanced

<

Small

<=

Smaller equal

==

Coming soon

>

Larger

>=

Greater equal

if(,,)

If-condition -> if(<condition>, <true>, <false>)

Bool functions

Function

Description

and(,)

Logical AND operator

neg(,)

Logically negate

or(,)

Logical OR operator

xor(,)

Logical XOR operator

Angle functions

Function

Description

DegreeToRad()

Convert angles to degrees to radians

RadToDegree()

Convert angles to radians to degrees

RadToMinus45Plus45()

Convert angles in radians to degrees and move them to the value range [-45°; 45°].

RadToMinus180Plus180()

Convert angles in radians to degrees and move them to the value range [-180°; 180°].

RadToZero360()

Convert angles in radians to degrees and move them to the value range [0°; 360°].

RadToZeroAngle(,)

Convert angles in radians to degrees and move them to the value range [0°; <default>°].

RadToMinusAnglePlusAngle(,)

Convert angles to radians to degrees and move to the value range [-<default>°; <default>°].

Mathematical functions

Function

Description

abs()

Absolute value of a number, amount

ceil()

Round up

cos()

Cosine

cosh()

Cosine hyperbolic

cot()

Cotangens

exp()

Exponential function

floor()

Round up

ln()

natural logarithm

log(,)

Logarithm -> log(<number>, <base>)

max(,)

Maximum value of two numbers -> max(<number1>,<number2>)

min(,)

Minimum value of two numbers -> min(<number1>,<number2>)

pow(,)

Power calculation -> pow(<number>, <power>)

round(,)

Round a number -> round(<number>, <decimal places>)

sin()

Sync by honeybunny

sinh()

Sinus Hyperbolic

sqrt()

Root calculation

tan()

Tangent

tanh()

Tangent hyperbolic