Formula editor
# About the formula editor
The formula editor is linked to all formula fields in simcision and can be opened by clicking on the expand button in the bottom right-hand corner.
In the formula editor, the formulas in simcision can be edited in three different ways: As a formula template, as a free formula and as a formula tree.
# Formula template
In template mode, the formula can be “assembled” using predefined methods.
- Select the formula to be used.
- In the second area, select the values to be calculated in the formula.
Available formula templates
Sum
All values entered are totaled.
Result:
@A + @B + @C
Average
The average is calculated from all the values entered. Each value can be weighted with a factor.
Result:
(@A*2 + @B*4 + @C) / 7
# Free formula
In “Free formula” mode, the formula can be entered in a formula field. The individual parts of the formula can be entered directly into the formula field or selected using the selection buttons below the formula field.
For a list of all available functions, see below.
# Formula tree
The formula can also be created and displayed graphically in the form of a tree. In the formula tree view, all calculation steps are displayed as branches of the tree.
The tree is read from top to bottom. Two (or rarely three) nodes together produce a result, which is displayed in the node below. This result can be offset against another field, resulting in a new result, and so on. At the bottom, at the end of the tree, is the overall result.
This view is helpful for tracing individual calculation steps of the formula, as all intermediate results are visible.
However, the tree can not only be viewed here, but also edited. Values can be entered in empty fields or number fields in the tree if the field is selected, or an element reference can be inserted from the buttons below the tree. Selected fields can be processed further by linking operators or functions to them.
# All available functions
The functions can be entered directly into a formula field by pressing the “#” key. The functions are available for selection as a list in the formula editor.
random between (A and B) | Results in a random (whole) number within the specified range, between number A and B (A and B included).
Example: random between (1 or 99) = 68 |
---|---|
smaller value (A or B) | Selects the smaller of two values.
Example: smaller value (3 or 7) = 3 |
greater value (A or B) | Selects the greater of two values.
Example: greater value (3 or 7) = 7 |
maximum value (A) | Results in the highest value that could theoretically arise from the expression in the brackets.
Examples: maximum value (@target) = 100; maximum value (@resource) = 1000; |
minimum value (A) | Results in the lowest value that could theoretically arise from the expression in brackets.
Examples: minimum value (@target) = 0; minimum value (@resource) = -1000; |
rounded (A) | Rounds the number A.
Example: rounded(4.3) = 4 |
rounded down (A) | Rounds the number A down.
Example: rounded down(4.7) = 4 |
rounded up (A) | Rounds the number A up.
Example: rounded up(4.1) = 5 |
absolute (A) | Removes the sign of the number A, is always positive.
Example: absolute(-4) = 4 |
sign (A) | Results in -1 for a negative number, +1 for a positive number and 0 for 0.
Example: sign(-56) = -1 |
square root(A) | Returns the square root of A.
Example: square root(16) = 4 |
exponent(A ^ B) | Returns A to the power of B.
Example: exponent(4 ^ 2) = 16 |
modulo (A mod B) | Remainder of a division.
Example: modulo(4 mod 3) = 1; |
e to the power of (A) | Returns e to the power of A.
Example: e to the power of(1) = 2.718281828459 |
if(A then B else C) | If A is not equal to 0, B returns, else C returns. |