"User-defined formula" function block
The function block for calculating a general formula can be used to put the data of one or more input channels through any desired calculation. For example, temperature compensation can be performed by linking an input channel with length data to another input channel with temperature data in a corresponding formula.
A particular input channel is designated in the formula by the variable starting with 'm' or 'delta' and ending with the position number of the channel. For example, the first input channel is designated by the variable 'm1' or 'delta1'. A unit compatible to the input channel can be specified in square brackets after the variable, e.g. 'm1[mm]' if the data of the input channel 'm1' represents a distance. If no unit is specified, the unit of the input channel is automatically inserted, e.g. 'm1[cm]' if the data of the input channel 'm1' represent a distance in the unit 'cm'.
Important: If an input channel has been specified, the formula must also contain the corresponding variable! The same applies for constants.
Under "Result Unit" you can enter the unit category (e.g. "Distance", "Angle", "Voltage" etc.) and the unit within the selected unit category which is to be used for the values of the output channel. The default is "Distance" for the unit category, and "m" for the unit.
Important: If a function block has already been saved, only the unit within the selected unit category can be modified, the unit category is fixed.
Note: If two or more channels that are connected through the formula were not measured at the same time, the data from the channels are first brought onto a common time grid => see Measuring Point Properties, under the "Extended" tab.
If a variable begins with "delta", the measured values of the corresponding input channel are not used in the calculation, but rather the differences between the measured values and the reference measurement: 'm_i - m_0', whereby 'm_i' represents the measured value at the time point 'i' and 'm_0' the reference value. For this, at least one reference measurement needs to have been defined in the "Reference measurements" tab.
Possible operations:
- Mathematical operators:
+, -, *, /, %, ...
- Comparison operators:
<, >, <=, >=, <> (ungleich)
- Brackets
- Mathematical functions:
abs(), sin(x), cos(x), tan(x), arcsin(x), arccos(x), arctan(x) pi, e, exp(), ln(), log()
- Case differentiations with
if(<Bedingung>; <True-Wert>; <False-Wert>)"
Examples of valid formulas:
m1[m] + 1,2345
m1[m] + c1
2 delta1[m] + c1
sqrt(m1[m] + m2[m] * m2[m]
if( (m1[m] > 0.5) ; 42; m1[m] )
Possible validation errors:
"The unit V is not compatible with the variable m1." Appears when the unit category is e.g. a distance, but you have specified a formula with 'm1[V]'.
"Formula variables and selected channels are inconsistent." Occurs when input channels were selected for which no variable was specified in the formula - or vice versa, and/or constants were not defined.