Application Functions as Basis for Function Templates
The following paragraphs list:
oThe criteria that must be fulfilled in order to save an application function with its associated field devices, I/O modules, and visualizations as function template;
oThe information that is saved in the function template.
Prerequisites for the Application
You can only create templates from correct applications. Correct means that no errors are detected during the build process.
Prerequisites for Saving an Application Function as Function Template
In order to save an application function as function template, it is a prerequisite that all programs of the application function are executed.
This means they must meet one of the following criteria:
oThey must be added to a task.
oThey must be called by another program.
Otherwise, they will not be considered when executing the Build command.
I/O Variables in Function Templates
An I/O variable is a variable that is mapped on an I/O channel of a field device. It is saved in the function template if the following conditions apply:
oThe I/O variable is used by any program or visualization that is included in the function template.
oThe field device or I/O module to which the I/O variable is mapped cannot be included in the function template.
You can map an I/O variable that is saved in the function template on an existing I/O channel when an application function is created from the function template.
The I/O variable has a description that is displayed in the Add Function From Template dialog box.
This description is created as follows:
oIf the I/O variable was newly created in the I/O Mapping tab of the device editor, the description is taken from the description of the I/O channel (this only applies if the original description has been changed).
oIf the I/O variable is a reference to an existing variable, the description is taken from the comment of this variable.
A template parameter is a variable with an adjustable initial value.
Example:When a device is used via a communication function block, then you have to assign the address of the device to this function block as an input parameter. To be able to set this address, connect a variable to the function block and define the variable as a template parameter.
A variable can become a template parameter if the following conditions apply:
oThe variable is defined in a program or global variable list that is included in the function template.
oThe variable has a simple data type (BOOL, any numeric data type, any STRING, alias types based on a simple data type).
oThe initial value of the variable is explicitly defined as a literal value.
All variables that meet these conditions can be selected as template parameter when the function template is saved.
If a variable was selected as a template parameter, the initial value of this variable can be adjusted when a new application function is created from the function template.
Objects Saved in Function Templates
The following objects are saved in function templates:
oThe objects that are available in the tree structure as subnodes below the Application node or below the Functional Model node.
oThe field devices and I/O modules that are used.
oThe function blocks, functions, or DUTs that are referenced by an object.