L-VIS User Manual
163
LOYTEC
Version 6.2
LOYTEC electronics GmbH
NOTE:
Math objects are often used as standalone objects, reading from the connected inputs and
writing the result back to a connected output. Such math objects are organized in folders,
either below the global object folder or within a folder located on a page. However, math
objects can also be used in place of input data points. In this case, they do not need an
output data point. They deliver the result directly to their parent object, for example a
control, a data point connector, or another math object.
9.13.1 Math Object Properties
Mathematical objects are configured on the
Math Object
property page, where basically
the formula is entered. Before doing so, it is important to connect the required input data
points to the object, so that they are available as variables for use in the formula.
All connected input data points are listed on the left side of the property page and variable
names are assigned to the data points in the order in which they are connected to the math
object. Variable names start with v1 and continue with increasing numbers, like v2, v3, v4
and so on. There is a limit of 127 input data points per math object. Formulas using more
than 127 input variables must be split into individual sub-expressions, which should be
done anyways since a formula with such a large number of variables becomes unreadable.
NOTE:
Always keep in mind that the order in which the input data points are connected to the math
object in the tree view defines the assignment of variable names for the formula. If you
replace input data points when the formula was already specified, be careful not to mess up
the data point order and thus the result of your calculations.
Using the assigned variable names, the user may now enter a formula directly below the
list. As you enter the formula, it will be parsed and the resulting sequence of calculations
will be displayed in a list at the right of the property page. This list shows your formula in
reverse polish notation (RPN), also known as postfix notation, as used by many scientific
pocket calculators. Users of such calculators will be immediately familiar with this list and
may find it more convenient to construct the formula using the list at the right, instead of
the input at the bottom. To learn more about postfix notation, there are a lot of resources
and articles readily available on the internet.
NOTE:
When the formula entered at the bottom is still incomplete and does not yield a meaningful
command sequence, the list showing the RPN equivalent will be empty. This allows the user
to immediately see if the current input is valid or not.
The ope, -, /, *, %, AND, OR, XOR, ^, &, |, =, !=, <, >, <=, >= can be used instead
of the explicit function calls. Further, it is possible to use parenthesis to define the
precedence of the operations.
The buttons and input fields in the middle of the page are used to directly edit the formula
using the reverse polish notation. To add a variable to the stack, double-click the variable in
the list at the left side, or select it and click the
Add Variable
button. To add a constant
value to the stack, enter the value in the input field above the button
Add Value
and then
press the button. To add a function to the stack, select the desired function from the
dropdown list and press the
Add Function
button. When a function is added to the stack, it
will first fetch as many values from the current stack as it needs input values, then execute
its operation, and put the result back on the stack.
NOTE:
Even if you use the infix notation at the bottom to enter your formula, the dropdown list of
available functions will be useful, to look up the names of functions you want to use and see
how many arguments they accept.
9.13.2 Application Hints
A few functions end with a … (three dots) in the argument list. This means that they accept
a variable number of arguments. When used in the formula, they will fetch all available
values from the stack (in RPN syntax) and then calculate the result, which will be put back