Functions and constants

With the help of the Function / Constant shape you can define arbitrary functions or constants, which cannot be implemented with the standard shapes from the library otherwise.

Drag a new Function / Constant shape onto the worksheet and select it. In the Properties sidebar on the right side of the working area, you can now enter the desired function or constant in the Function field. Use placeholders of the form ${n} as input parameters, where {n} must be an incremental integer number.

Examples

Input

Description

4

Constant value 4

$1*1.5

Multiplication of the input value with factor 1.5

$1+$2+$3

Addition of three input values

($1+$2)/2

Arithmetic mean of two input values

The following functions are available. Replace the function arguments with either constants, other functions or the placeholder of an input parameter ($1, $2 etc.).

Function

Description

abs(x)

Absolute value

acos(x)

Arc cosine

asin(x)

Arc sine

atan(x)

Arc tangent

ceil(x)

Round up to the next integer value

cos(x)

Cosine

exp(x)

Exponential function (\(e^x\))

floor(x)

Round down to the next integer value

log(x)

Logarithm to the base e

max(a, b)

The larger value of a and b

min(a, b)

The smaller value of a and b

pow(a, b)

Power function (\(a^b\))

random()

Random number between 0 and 1 (including 0)

round(x)

Mathematical rounding to the nearest integer

sin(x)

Sine

sqrt(x)

Square root

tan(x)

Tangent

todegrees(x)

Angle conversion from radians to degrees

toradians(x)

Angle conversion from degrees to radians

Furthermore the following operators are supported:

Operator

Description

(

Opening parenthesis

)

Closing parenthesis

+

Addition (for number and strings)

-

Subtraction

*

Multiplication

/

Division

%

Modulo (remainder of a division)

+

Unary plus (returns the numeric value of the operand)

-

Unary minus (returns the negative value of the operand)

=

Equality

!=

Inequality

<

Less than

<=

Less than or equal to

>

Greater than

>=

Greater than or equal to

&&

Logical And

||

Logical Or

!

Logical Not

Warning

Since Avelon always performs the calculation of data points in their SI base unit, the constant or function shape must also provide its values in the corresponding SI base unit. This means that even if you connect the function shape to an energy data point with the unit kWh, it must output its calculation in joules for the calculation to work correctly.