ML-x17 DATA LOGGER MANUAL
Manufacturers of low power instruments
page 49
4.18.1 Syntax
Within the data logger each sensed/calculated parameter/channel has a parameter code chosen by the
user (e.g. TEMPC for a temperature in Celsius,
Attention
: codes should not contain any spaces or
signs). These parameter codes can be used in equations by preceding them with a colon (:). When
calculating the parameter codes will be substituted with the last recent measured values.
It’s possible to
use multiple parameters in one equation. The order of operations (add, subtract, divide and multiply) is
the same as when using a calculator and parentheses can be used to group operations together if you
are confused about the order of operation.
Note:
Analog inputs are having a user defined/calibrated slope to convert analog input values to
engineering values. You can use the minimum and maximum engineering values of the slope (e.g. to
calculate a percentage from a water level) in your calculations by trailing a parameter code with the term
.MIN or .MAX (e.g. :AIN1.MAX). It
’s also possible to use defined alarm limits (.LOLO, .LO, .HI, and .HIHI)
in your calculations. When an input value is acquired successfully it will be timestamped, you can use the
.AGE attribute to check the age of a value in seconds since the last valid acquisition.
4.18.2 Functions
Besides using simple operators, mathematical functions can be used as well. The syntax of a function is:
<function_name>(<arguments>).
Example: sin (x) (calculates the sinus of x)
4.18.3 Example 1
A measured tank liquid level could be compensated with temperature and passed thru an equation to
calculate the contents of the tank in kg.
Within the data logger each sensed parameter/channel has a parameter code chosen by the user (e.g.
TEMPC for a temperature in Celsius). These parameter codes can be used in equations by preceding
them with a colon (:). When calculating the parameter codes will be substituted with the last recent
measured values. You could enter the equation
round((:TEMPC*1.8+32)*10)/10
to convert a
temperature in Celsius to Fahrenheit and round the result to one decimal.
4.18.4 Example 2
Assume we measure a river height in m (parameter code LEVEL) and want to convert it to a flow by using
the pre-determined polynomial: (see graph below) y=-0.253x
3
+ 21.675x
2
– 359.14x + 1677.5
Then the formula should be entered as follows: -0.2535*pow(:LEVEL;3) + 21.675*pow(:LEVEL;2) -
359.14*:LEVEL + 1677.5