• Reference
  • ECA
  • Function Library

Function Library

Previously, we have a preliminary learned the Trigger - Function Library. The following briefly introduces how to use the function library.

Adding a Function

You can convert commonly used Trigger statements into functions in the library for reuse. After adding a statement to the Function Library, you can find the function statement in Triggers and directly use it. The operation logic of the function library is the same as that of Triggers. After a function is created on the left, you can edit its content on the right.

E50

Function Description

Function Description defines the display mode of the function in the Action list. Function Description includes the following content:

Name: Name of the Trigger statement to be generated.

Description: Content and format of the Trigger statement to be generated.

Attention: Description of the current function.

E50-1 In the window shown above, double-click Function Description or click the pencil icon, you can enter the window shown below to set the function. Click Available Parameters to set the parameter type, such as Timer, Unit, and Integer.

E51

Parameter

The Parameter statement defines the variables that need to be specified in the Trigger statement.

E50-2

Return Value

The Return Value indicates the result returned after an Action is executed. For example, if you set A+B in the Action and set A to 1 and B to 1 in the Parameter, the Return Value is 2.

E50-3

You can click the “+” to set the Name and Type of the return value to facilitate subsequent calls of the Trigger.

E52

Action

The Action statement lists the Actions of the function, showing the specific logic of the function. The method to modify the Action is the same as the method to write a Trigger.

E50-4

Calling the Function Library

When you add an Action in a Trigger by selecting a function, you can see all functions in the Function Library in the Function tab. After selecting a required function, the Action takes effect directly and the Parameters of the function exist as the variables to be specified.

E53