The HSDL channel math is performed on-the-fly, immediately after the data is acquired. The inputs to channel math can be up-to five measured analog, digital or camera channels or even other math channels. The formulas applied can contain any common algebraic operators, functions. In addition, a configurable digital filter can be applied to an input channel. The result of the channel math can either be stored in a new math channel or original input channel value can be overwritten. The channel math formula syntax is similar to common math formula notation, partly based on ANSI C.
Channel math formulas can contain any combination of the following operators as long as they are compliant with general algebraic rules. The operators are internally evaluated in 64 floating point data type.
Operator | Description | Result | Examples | Examples Explanation |
^ | Power of X | a^2 a^0.5 |
a powered by two square root of a |
|
* | Multiplication | a * b a * 4 |
a times b a times 4 |
|
/ | Division | a / b a / 3.25 |
a divided by b a divided by 3.25 |
|
+ | Addition | a + b a + 0.1 |
a plus b a plus 0.1 |
|
– | Subtraction | a – b | a minus b | |
> | Greater | 1 if greater 0 if not greater |
a 0 a |
a smaller than 50 a smaller than b |
= | Greater or equal | 1 if greater or equal 0 if not greater or equal |
a =7.8 a =b |
a less or equal to 7.8 a less or equal to b |
< | Smaller | 1 if smaller 0 if not smaller |
a > 4 | a greater than 4 |
>= | Smaller | 1 if smaller or equal 0 if not smaller or equal |
a >= b | a greater or equal to b |
== | Equal | 1 if equal 0 if not equal |
a==b | a equal to b |
!= | Not Equal | 1 if not equal 0 if equal |
a!=300 | a not equal to 300 |
AND | Logic Multiplication | 1 if both operands are non-zero 0 if any operand is zero |
a AND b | |
OR | Logic Addition | 1 if any operand is non-zero 0 if both operands are zero |
a OR b | |
NOT | Negation | 1 if operand value is 0 0 if operand value is not 0 |
NOT (a) | Inverted logic value |
Channel math formulas can contain any combination of the following functions as long as they are compliant with general algebraic rules. The functions are internally evaluated in 64 floating point data type.
Function | Description | Examples | Examples Explanation |
abs | Absolute value | abs(a) | Absolute value of a |
sin | Sine, argument in radians | sin(a) | Sine of a |
cos | Cosine, argument in radians | cos(a) | Cosine of a |
tan | Tangens, argument in radians | tan(a) | Tangens of a |
asin | Arcus Sine, result in radians | asin(a) | Arcus Sine of a |
acos | Arcus Cosine, result in radians | acos(a) | Arcus Cosine of a |
atan | Arcus Tangens, result in radians | atan(a) | Arcus Tangens of a |
exp | E raised to power of x | exp(a) | Euler’s number powered by a |
ln | Natural logarithm | ln(a) | Natural logarithm of a |
log | 10-base logarithm | log(a) | 10-base logarithm of a |
sign | Sign returns 1 for x greater than 0 returns 0 for x equal to 0 returns -1 for x smaller than 0 |
sign(a) | Sign of a |
sqrt | Square root | sqrt(a) | Square root of a |
pi | Pi (3.14159) times argument | pi(a) | Pi times a (equivalent to 3.14*a) |
Formula Examples | |
(a + b + c)/3 | Average of three channels |
(a > 350) OR b | A greater than 350 or b in logic 1 |
a AND b AND c | Logic multiplication of three inputs |
sqrt(a/2+exp(b*7.24)) |
Math formulas can contain any number of spaces between its elements in order to improve readability of the formula. Spaces are removed internally before calculation.
The number of digital filters can be applied to input signals. Each configured digital filter has only one input channel and cannot be mixed with operators or math functions. The available filters include typical IIR and FIR filters, which can be either designed in configuration screen or loaded from a text file in form of impulse response.
A special case of digital filter is an RMS value calculator.
The number of concurrently running digital filters depends on the HSDL sampling rate, number of filter coefficients and computational load caused by other running HSDL tasks. When attempting to start the recording with too many filters the recording is not started and user is alerted about too high CPU utilization.
Additional special filters or other math operations can be provided as a custom development.