L-VIS User Manual
164
LOYTEC
Version 6.2
LOYTEC electronics GmbH
on the stack and be the only value on the stack, since all other values were used as input to
the function.
This behavior causes some limits in how these functions may be used. You are on the safe
side, if you use such a function only as the outermost function, or, in RPN, as the last
function on the stack, for example:
sum
(v1, v2, exp(v3, -1))
Or, in RPN notation:
v1, v2, v3, -1, exp,
sum
CAUTION:
If you have to use such a function as an argument to another function, it may
only be used as
the first argument.
Otherwise the formula cannot be processed by the
math object, which internally uses an RPN machine with precompiled instructions for
optimal performance. Example:
add(
avg
(v1, v2, v3), 5)
or the equivalent
avg
(v1, v2, v3)+5
will work.
add(5,
avg
(v1, v2, v3))
or
5+
avg
(v1, v2, v3)
will
not
work.
To limit the number of re-calculations, the data point update option
Value changes only
should normally be checked on all connected input data points. This avoids recalculating
the formula and writing a value to the output data point when it is already clear that the
result will be the same, because the input value did not change. The same option can also be
checked for the output data point to avoid unnecessary writes to the output data point, in
case the inputs changed but the result of the formula is still the same.
NOTE:
Especially for projects which use a lot of cascaded formulas, where the result of one
formula is used as input to a number of other formulas, it may cause a big difference in
CPU usage whether results of the same value are forwarded to other math objects in the
system or not, because they will trigger recalculation of a potentially large number of other
formulas, which will generate even more results of the same value (since the originating
value did not change).
Note that the function
rand()
takes no arguments. It always returns a random number
between 0 and 1. To generate a random number between the two limits L and H, use a
formula like this:
L+(H-L)*rand()
.
For cases where the low limit L is 0, this is reduced to:
H*rand()
.
Example for a random number between 20 and 30:
20+10*rand()
.
9.13.3 Function List
The following function calls are currently supported: