Skip to main content
Skip table of contents

Mathematics

mathematics.svg

The mathematics job is not only offering all usual mathematical operations but beyond that also a lot of mathematical functions. At the end of this description, you will find some examples for this.

EIS Formats

The math job supports the following datatypes at the input- and output-object.

  • EIS 1 (1 Bit)

  • EIS 5 (2 Byte FP)

  • EIS 6 (1 Byte)

  • EIS 9 (4 Byte FP)

  • EIS 10s (2 Byte Value)

  • EIS 11s (4 Byte Value)

  • EIS 14u (1 Byte unsigned)

  • EIS 15 (14Byte Text)

Beside that the jobs disposes a gate object as well as an EIS 14 output for an error code and an EIS 15 text output for an error text. They are given out when the flag “Runtime Errors” is activated.

Job Name

Required field. Assign a unique name for the job. The name must not contain more than 15 characters.

Gate Group Addresses

By Gate Group Addresses job will be released or blocked. It is about an EIS1 object:

  • Field blank = Job is released.

  • Field completed, value 1 = Job released.

  • Field completed, value 0 = job locked.

  • Field completed, no value = job locked.

As soon as one address is filled in, release will behave respective to the value of the group address. If no value was sent to the address and the address is presently without values, job will be blocked.

Runtime error issue

If this flag is enabled, error codes and error messages via EIS 14 EIS issued by telegram 15. The addresses to be entered into the fields below. An overview of error codes is at the end of the job description.

Exit / access to the initial value

The value of the output object can use the variables "eo_out ()" is also used for the calculation. The operation can never be "eo_out ()" is triggered.

Inputs

Each mathematics job contains 12 input objects. This could correspond to the above-mentioned datatypes. Also, can be determined when a telegram abutting the selected input to calculate the formula. To enter a group address either the keyboard or the ESF-Dialogue can be used. For the ESF Dialogue the arrow button next to the address entry array has been pressed. You will reach the overview of the data which will be uploaded into the EIBPORT before (also see chapter “KNXnet/IP | ETS”).

Note: All values within the mathematics job are generally calculated unsigned, i.e. without signs. If you want values to be shown with signs, please make the appropriate settings in the visualisation element.

Calculation of the formula

The selection in the dropdown menu determines when the calculation of the formula is triggered in the mathematical expression:

  • Always: The calculation will be triggered when any input is detected at the input object.

  • Never: The calculation is that input never initiated. Of course, the value of the input object in the execution of the operation is considered.

  • If the value is changed: Only if changing the input value against the previous value, initiated a calculation.

Job Editor Classic - Job mask mathematics

Access onto the input in the mathematical expression

To use the input objects for the mathematical expression the following syntax applies:

  • The inputs 1-12 own the index numbers 0-11.

  • By entering “eo(number of index)” the respective value of the input objects has been fetched for the mathematical expression. For the input 1 so is entered “eo(0)”.

  • If the other way round the index number of an object should be issued (and eventually continue to use) on which at last a telegram was incoming, it can be done by entering “eoi()”.

Mathematically Expression

In this array the required mathematically expression will be put together. Doing this the usual mathematical rules applies. To output the result, it is too considered that the value of the result is not exceeding the range of the datatype set in the output object. The following operations are available:

Note: Internally, the math module can work with floating point numbers or texts.

Mathematical operations

Symbol

Description

+

Addition (resp. stringing together)

-

Subtraction

*

Multiplication

/

Division (real numbers)

%

Modulo (Rest of an integer division)

&

“AND”- operation bit by bit

|

“OR” – operation bit by bit

^

Raise to higher power

Logical (boolean) operations

Symbol

Description

||

Logical OR

&&

Logical AND

>

Comparison operation “Greater than”

>=

Comparison operation “Greater than or equal”

<

Comparison operation “Less-than”

<=

Comparison operation “Less or equal”

==

Comparison operation “Equal”

Other operations

Symbol

Description

=

Allocation

'(' und ')'

Parenthesis for changing the operator process

?:

If-Then-Else Operator ( Variable = requirement ? Value is true : Value is false)

Built in Functions

Symbol

Description

sqrt(x)

Square root calculation

sin(x)

Sinus calculation

cos(x)

Cosinus calculation

tan(x)

Tangens calculation

max(x,...)

Maximum determination of a (finite) number of values

min(x,...)

Minimum determination of a (finite) number of values

rad(x)

Conversion from degrees into radian (arc calculation)

asin(x)

Calculation of arc sine

acos(x)

Calculation of arc cosine

atan(x)

Calculation of arc tangent

ceil(x)

Calculation of the smallest integer value which is not smaller than the argument ("round off").

floor(x)

Calculation of the largest integer value which is not larger than the argument ("rounded down").

abs(x)

Calculation of an absolute value of an argument

exp(x)

Calculation of the exponential function of the base „e“ (Euler’s constant)

log10(x)

Logarithm to the base 10

pow(x,y)

Exponential function calculating x^y

time()

Is giving out the system time since the beginning of the epoch (00:00:00 UTC, January 1, 1970)

srand(x)

Is setting the (pseudo) random generator to defined start value.

rand()

Is giving out the next random number.

eo_sum(x,...)

Adding the EIB-objects with this numbers according to the arguments.

int(x)

Is cutting of the real number and is only given back the integer.

modf(x)

Is giving back the decimal part of a real number (the digits after the decimal point).)

round(x)

Is giving out a correct rounded integer of a real arguments.

eoiga()

Returns the group address that triggered the calculation (not format!)

eo_ga(idx, idx_ga)

Returns the group address of an object unformatted. idx specifies the index number of the input idx_ga the index number of the group address in the Object. Both start at "0" to include (from left to right).

ga_str(ga, fmt)

Returns the wanted group address (ga = index number) as a string (EIS 15) to the output. Using "fmt", 2 - or 3-digit notation can be determined.

str_ga(str)

Outputs a desired group address as an integer. 2 - or 3-digit notation does not matter.

version()

Returns the version number of the math module back. We have the "18" = Version 1.2 (0x12) and "17" = Version 1.1 (0x11).

Datatypes and Strings:

Kind

Notation

Integer numbers

42

Hexadecimal numbers

0x12ab

Real numbers

1.23

Exponential numbers

1.23e3 fĂĽr 1.23 * 10^3 or 1023.0

Text

"text"

Note: A "." (period) must be used as decimal separator, otherwise the expression becomes invalid.

Predefined constants:

Symbol

Description

M_PI

The constant pi (3.14.....).

M_E

Euler’s constant (base of the natural logarithm)

M_LOG2E

Logarithm to the base 2 from 'e'

M_LOG10E

Logarithm to the base 10 from 'e'

M_LN2

Natural Log. from 2

M_LN10

Natural Log. from 10

M_PI_2

Pi divided by 2 ("Pi-Half")

M_PI_4

Pi divided by 4 ("Pi-Quarter")

M_1_PI

Reciprocal value from Pi (1 divided by Pi)

M_2_PI

2 times 1 divided by Pi

M_2_SQRTPI

2 times 1 divided by square root of Pi

M_SQRT2

Square root of 2

M_SQRT1_2

Reciprocal value of square root 2 (resp. square root of 1/2)

Self-defined variables and multiple expressions after another:

“a=10” allocates the variable “a” the value 10. “a=1; b=2; a+b” allocates the values 1 resp. 2 to the variables “a” and “b” and is giving out the result “3”.

Important: That way defined variables only have a limited validity within one calculation of one expression!

Reservierte Variablen

Variable

Description

override_addr

If the value of this variable is equal to "0", is the true starting address is discarded, and instead interpreted the value of this variable as a starting address (1-digit notation).

override_eis

If the value of this variable equal to "0", the actual data type is overridden by this configuration. We do not make adjustment of the value.

override_skip_send

If the value of this variable equal to "0", the transmission will be aborted. The current calculation leads to no result.

override_keep_data

If the value of this variable equal to "0" is not the calculated output value, but uses the input value of the calculation has been initiated.

Examples:

Here some examples so that the using of the several functions and operations becomes a little bit clearer:

  • „eo(1) + 100“ -> Is giving out the EIB-object with the number one (hereafter EO_1) added by 100. Of course, every time important is paying attention to the possible range of the EIB output object!

  • „eo(3)*eo(4)“ -> Multiplies EO_3 and EO_4. If there are EIB-objects which are not provided with a groupaddress, a failure is beeing noticed.

  • „100 / eo(1)“ -> Divides 100 by EO_1. Attention: If a null is being sent on the input 1 the calculation is giving out a runtime error! (“Division by null”).

  • „sqrt(eo(0)^2+eo(1)^2)“ -> Is calculating the length of the hypothenuse in a right angled triangle, if on EO_0 und EO_1 the length of the catheters is beings sent („Pythagorean theorem“).

  • „eoi()“ -> Is giving out a 2 if something is received on the EIB-object with the number two.

  • „eo(eoi())“ -> Is giving back the receiving value.

  • „eo(eoi())^2“ -> Is calculating the square for every transceiver telegram value.

  • „rand()“ -> Is giving out the random value.

  • „rand() & 0xff“ -> Limits this value on a range from 0 to maximum 255. So, the result must be presentable in EIS 14.

  • „srand(time())“ -> Ist giving out nothing (resp. null), but is initializing the random generator with a pseudo-random start value.

  • „eo(0)+eo(2)+eo(3)+eo(1)+eo(5)+eo(6)+eo(4)“ -> Is calculating the sum of multiple EIB-objects.

  • „eo_sum(0,1,2,3,4,5,6)“ ->Like above, but plenty more „runtime-friendlier“ and more insight.

  • „"foo" + "bar"“ -> Is giving out the result „foo bar“. This only works if the output is switched to EIS 15 datatype.

Error Codes and Error text

Number
(Error Codes EIS 14)

Meaning resp. EIS 15 text output

0

No Error

42

Syntax error

43

General runtime error (e.g.: division by null or tan(PI/2))

1

Missing right bracket

2

Missing left bracket (with embedded function)

3

Missing right bracket (found expression instead)

4

Unknown variable

5

Unknown keyword

6

Error in String expression: String contains no mathematical operator.

7

Division by null

8

String cannot be exponentiated

9

Error in String expression: String cannot be arranged with operator.

10

Missing right bracket or comma at function call.

11

Missing comma

12

Missing argument

50

Error in EO-function: Wrong number of arguments

51

Error in EO-function: Wrong index

52

Error in EO-function: EO is empty

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.