
L-DALI User Manual
118
LOYTEC
Version 5.2
LOYTEC electronics GmbH
Auto-generated data points in connections are created such that they have a best-
matching unit in their target technology (e.g., the best-matching SNVT is created out of
a BACnet data point of a certain engineering unit).
6.2 Math Objects
6.2.1
General Properties
Math objects are advanced application objects that can execute mathematical operations on
data points. A math object takes a number of input data points (variables
v
1
,
v
2
, …,
v
n
) and
calculates a result value according to a specified formula. The result is written to a set of
output data points. The formula is calculated each time one of the input data points updated
its value. The formula is only evaluated if all of the input data points have a valid value (i.e.,
don’t show the
invalid value
status).
Using the assigned variable names, immediate values, parenthesis, operators and function
names, the user can enter a formula in the usual way (infix notation). Apart from the
functions in the next Section, the short-hand operators
+
,
-
,
/
,
*
,
%
,
AND
,
OR
,
XOR
,
^
,
&
,
|
,
=
,
!=
,
<
,
>
,
<=
,
>=
can be used directly. Further, it is possible to use
parenthesis to define the precedence of the operations.
Example:
(v1 + v2) * sqrt(pow(v3,0.1))
Note:
As usual practice in programming languages, the comma is used to separate arguments in
expressions and the
decimal point
is used in decimal values. The expression
sum(4,5)*2
evaluates to 18, while
sum(4.5)*2
evaluates to 9.
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.
6.2.2
Usage 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 and then calculate the result, which will be put back 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 (infix), or as the last function
on the stack (postfix) for example:
sum(v1, v2, exp(v3, -1))
Or the postfix equivalent:
v1, v2, v3, -1, exp, sum
If you have to use it as an argument to another function, it may only be 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
avg(v1, v2, v3)+5
will work.
add(5, avg(v1, v2, v3))
or
5 + avg(v1, v2, v3)
will NOT work.
Another property of those functions is that they ignore input values, which have the invalid
value. Therefore, assuming v1=5, v2=invalid, v3=3 the calculation
add(v1,v2,v3)