Skip to main content
Version: 5.5

Creating templates

The following example assumes that the OPC server and database are correctly connected. In this example, the tags in the OPC server are precisely configured so that only a single template variable is required to capture the data.

  • In the "Templates" snap-in, select the "New Template" button or right-click on an existing entry and select "New Template."
  • Assign a name.
  • Define the connection properties for the template. The properties are applied to all instances.
  • Configure the connection. The OPC server is configured so that the data points (tags) have identical names and are located in different access paths. This path would therefore be created as a template variable. Place an OPC transfer object in the template and open it by double-clicking. Unlike normal connection configuration, you will also find the template variables in the dialog box.
  • Create a template variable "Channel." To do this, click on "Add" under the template variables and enter a name ("Channel") and type ("String"). Even if an integer is entered here, the template variable must be of type "String" in order to compile the path.
  • Enter the properties. First, insert the template variable using drag & drop. It will be integrated into the transfer object with the correct syntax. Then add the static string.
NameValue
OPC connection<name der="" anbindung="" aus="" plug-in-konfiguration="">
OPC data pointsg\_atDBDataBlock\[**{Channel}**].rRealData
  • Close the OPC transfer object.
  • Configure a database transfer object for recording. At this point, a table TBL_DataChangePerformance should be used for recording. The measurement series is determined by the ConfigID field, and the timestamp is set by the database.
NameConfiguration
DB connection<name der="" anbindung="" aus="" plug-in-konfiguration="">
TypeInsert
TableTBL_DataChangePerformance
Columns usedConfigID, Value
  • Project a constant with the template variable "Channel." The constant must be of type Auto so that the string can be converted to an integer at runtime (the "ConfigID" column will expect this).
  • Connect the constant to the ConfigID and the data point to the Value.
  • Project a bit trigger to trigger the transfer. Either activate "Reset bit" or insert a response bit, depending on the PLC program.
NameValue
OPC data pointg\_atDBDataBlock\[**{Channel}**].tHandshakeBits.xTrigger

The template is now complete. You can organize templates into groups just like normal connections.

Handling template variables in objects

Template variables can be added

  • using the "Add" button in the object dialogs.
  • using the buttons with the blue plus sign next to the individual fields. This creates and enters a new variable of the correct type.

The button with the red minus sign removes the template variables from the fields.

Existing template variables are dragged and dropped into the corresponding field.

Template variables with OPC-UA

Please note the following for project planning:

  • If the OPC connection itself is a template variable, the router cannot know the specification. It then only offers the Data Point property. If you create a connection from the template and the OPC connection is an OPC-UA connection, the node ID must be entered under Data Point.
  • If the data points are template variables for OPC triggers (bit, data change, message, limit value), you must also specify the node ID here when creating a connection from the template.

Creating templates from connections

You can generate a template from a connection:

  1. Select a connection in the snap-in area.
  2. Right-click and select "Create template from connection."
  3. Give the new template a unique name and confirm with "OK."
  4. If you activate the "Open template directly" checkbox at the bottom of the window, the template will open after it has been created.