Creating User Defined Types - UDTs

What is a UDT?

UDTs (User Defined Types), also referred to as Complex Tags, offer the ability to leverage object-oriented data design principles in Ignition. Using UDTs, you can dramatically reduce the amount of work necessary to create robust systems by essentially creating parameterized "data templates".

By defining UDTs and using these essentially “data templates”, you can generate Tag instances to rapidly build complex screens. A change to the type definition is then inherited by all instances, drastically saving time when making routine changes.

The UDT data types are fully supported by Vision Templates, which means you can configure templates for your custom data types and take advantage of drag-and-drop binding to rapidly build complex screens.

Primary UDT Features

Object Oriented
Use small or large groups of Tags to create a single object. Create objects that match your real world devices or the existing structures in your PLCs.

Central Definition
Once you define your data type, you can then create instances of it. If at a later time you want to change some aspect of the type, you can simply edit the type definition, and all instances of it are automatically updated.

Parameterized Settings
Define custom parameters on your data type, and then reference them inside some or all of your member tags. When it comes time to create instances, you can simply modify their parameter values in order to change where the underlying data comes from.

Extendable
Data types can inherit from other data types in order to add additional members or override settings. Instances can also override settings, allowing for flexibility when dealing with irregularities and corner cases.

On this page ...

UDT Terminology

Many terms are frequently used when discussing complex tags:

UDT
User Defined Type - the definition of the data type is its structure, Tags, attributes, and settings.

Instances
Instances are running copies of a data type with specific data for all members. Instances are linked to their parent types and are reloaded when their parent type changes. Besides specifically overridden settings, all settings are inherited from the type definition.

Parameters
Parameters are custom properties on data types that you can use inside the type or instance definition to create parameterized data templates. For example, if a data type consists of 3 OPC tags that only differ by a number in the path, you can use a parameter for the "base address", allowing instances to be created with only 1 setting.

Members
Members are the Tags inside of a data type or instance.

Defining UDTs

You can save time and quickly generate data types from existing structures. This is particularly useful, for example, when data types are already defined in the PLC. Creating a new data type is very similar to creating standard tags. You can open the Tag Browser and drag multiple tags or folders into the Data Types folder, or you can create them manually by right-clicking and selecting New Tag.

Converting from existing Tags

To create a data type from existing Tags, simply select the tags or folders you wish to include, right-click and select Create Data Type from Selected. The Tag Editor window is displayed with the selected tags pre-populated as members. From here you can modify the tags, add parameters, and so on. The original tags will not be affected.

Tip: If you select a single folder as the root to create the type from, its sub-members will be added, and its name will be the basis for the type (that is, the folder itself won't be included in the structure).

images/download/attachments/6034177/udt_from_folder.png

Creating from OPC

If you have data types defined in your PLC (or OPC server), you can short-cut the conversion step outlined above by simply dragging the tags (or the folder for the type) from the OPC Browser directly onto the Data Types folder, and selecting Create Type from the subsequent dialog.

images/download/attachments/6034177/drag_udt.png

Creating Instances of UDTs

Creating instances of complex types is virtually identical to creating other types of tags using the New Tag menu. Unlike standard Tags, it is likely that you'll have to modify attribute values or override certain member properties in order to make the instance unique. The process for doing this is the same to that used when creating data types. Once created, instances run very much like standard Tags. If the parent data type is updated, the instance will automatically receive the updates and refresh.

Creating Instances Manually

You create individual instances of a UDT in exactly the same way as a basic Tag. Right-click and select New Tag, then the type of UDT you want.

images/download/attachments/6034177/udt_instance.png

Using the Multi-Instance Wizard

The multi-instance wizard provides a powerful but simple mechanism for rapidly generating many instances of a data type, by specifying patterns for parameters. To get started right-click a tag in the Tag Browser, then select New Tag > Data Type Instance > Multi-instance Wizard from the menu. The Instance Creation Wizard window is displayed. Once you select a data type, you will see its parameters come into the table, where you can specify values for them. The size of the parameter patterns dictate how many tags are created, or if only single values are specified, you can choose to create multiple copies of the same configuration.

images/download/attachments/6034177/multi_instance.png

Similar Topics ...

In This Section ...