Simple nodeset with base types

This documentation article is intended to get you started using this product quickly. After successful installation and licensing, perform the following steps to create an initial nodeset.

Simple nodeset with base types 1:

OPC UA Base Nodeset

By default, the TwinCAT OPC UA Nodeset Editor automatically loads the OPC UA Base Nodeset, which defines the namespace http://opcfoundation.org/UA/.

Simple nodeset with base types 2:

TF6100 TC3 OPC UA Server

This product works together with the TwinCAT OPC UA Server to run a created nodeset and display it on the server’s address space. Please make sure that the product TF6100 TC3 OPC UA Server is installed on your system.

The following Quick Start Tutorial will guide you through the following steps:

Preparing a PLC project

Create a new TwinCAT project and add a PLC project. Create the following data structure in the PLC project and instantiate it three times in the MAIN program.

TYPE ST_MyStructure :
STRUCT
  MyBoolean : BOOL;
  MyInt16 : INT;
  MyFloat : REAL;
END_STRUCT
END_TYPE

PROGRAM MAIN
VAR
  MyStruct1 : ST_MyStructure;
  MyStruct2 : ST_MyStructure;
  MyStruct3 : ST_MyStructure;
END_VAR

Creating a new project

To create a new nodeset project, please open the menu File and click on New \ Project.

Simple nodeset with base types 3:

In the selection dialog that follows, you can specify the name and a target directory for the new project.

Simple nodeset with base types 4:

Creating Instances

In this tutorial, we want to create a number of instances with simple data types (Integer, Boolean, Float) and group them in three different folders.

Go to the Instance Explorer and add three folders by selecting the Objects node and choosing Add Folder from the context menu. The three folders will then be shown as follows:

Simple nodeset with base types 5:

Rename the folders by double-clicking on each folder and adjusting the Name attribute in the Attribute Explorer accordingly. Save this change via the Save button on the toolbar.

Simple nodeset with base types 6:

Perform this procedure for all three folders so that the Instance Explorer looks like this:

Simple nodeset with base types 7:

In the next step we want to add some variables to the folders.

Creating new variable or object instances is usually done by a drag and drop operation from a data type on the Type Explorer. Select the first folder in the Instance Explorer and then navigate to the desired data type in the Type Explorer. Drag and drop the data type onto the selected folder in the Instance Explorer. As a result, a corresponding instance of this data type is created there. In our example, we use the Boolean data type.

Simple nodeset with base types 8:

We now repeat this step with two more data types, e.g. Int16 and Float, and perform this process for the other two folders as well. If necessary, you can adjust the name of the added variable by double-clicking on it and then renaming it in the Attribute Explorer.

Simple nodeset with base types 9:

Linking with PLC variables

We want to link the now created instances with variables from our prepared PLC project. For this purpose, the TwinCAT Target Browser can be used, which you can open in the menu View.

Navigate to the prepared PLC project in the Target Browser and link the individual member variables of the ST_MyStructure data structure with the corresponding instances by dragging and dropping them onto the corresponding node in the Instance Explorer.

The link is then visually visible in the tree and can also be checked in the Attribute Explorer.

Simple nodeset with base types 10:

Perform this procedure for all variables.

Simple nodeset with base types 11:

Deploying the project to TwinCAT OPC UA Server

To deploy the project to the TwinCAT OPC UA Server, click on the Export to TwinCAT OPC UA Server button in the Instance Explorer toolbar. This exports the project nodeset to the locally installed TwinCAT OPC UA Server and also creates a corresponding configuration file for the server. Please make sure that you restart the TwinCAT OPC UA Server after you have deployed the nodeset so that the configuration is loaded. The address space of the server then contains the created nodes, which were linked with the corresponding PLC variables.

Simple nodeset with base types 12: