User-Defined Function Blocks
The list of programs is completed with "User-Defined Function A function calculates a result according to the current value of its inputs. A function has no internal data and is not linked to declared instances. Blocks" (UDFBs). UDFBs are described using , FBD "Function block diagram" A function block diagram describes a function between input variables and output variables. A function is described as a set of elementary blocks, FFLD, ST "Structured text" A high-level language that is block structured and syntactically resembles Pascal or IL "Instruction list" This is a low-level language and resembles assembly languages, and can be used as other function blocks in the programs of the application. Input and output parameters plus private variables of a UDFB "User Defined Function Block" UDFB can be used as a sub-function block in another program of the application. It is described using FBD, LD, ST or IL language. Input / output parameters of a UDFB (as well as private variables) are declared in the variable editor as local variables of the UDFB are declared in the variable editor as local variables of the UDFB.
There is no restriction using any operation in a UDFB. A UDFB can call standard functions and function blocks.
A UDFB can call another UDFB. Note that the called UDFB must be declared before the calling one in the program list.
Each time a UDFB is instantiated, its private variables are duplicated for the declared instance. The code of the UDFB is duplicated on each call in parent programs. This leads to higher performances at run-time In computer science, runtime (or run-time) describes the operation of a computer program, the duration of its execution, from beginning to termination (compare compile time). Within KAS, runtime also refers to the virtual machine that manage the program written in a computer language while it is running, but consumes code space. It is recommended to package small algorithms in UDFBs. Large parts of code must be managed in programs.