Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

 

UDT Overview

So far, we have only dealt with simple Tags.  In Ignition, you can also create Complex Tags or User Defined Types (UDTs). These types can model UDTs in certain PLCs (such as a ControlLogix) or can be completely new.

You create the UDTs in a special folder in the Tags Browser called Data Types.


UDTs (User Defined Types) can be created in the following different ways:

  • Browsing OPC servers via OPC Browser
  • Creating UDTs from existing Tags
  • Creating UDTs manually

If your PLC supports UDTs, the easiest way to create a user defined type is from OPC. 

To create

On_this_page

 

Scroll HTML Exporter Ignore

Iulink
URLhttps://www.inductiveuniversity.com/video/creating-udt-definition?r=/course/tags
NameCreating UDT Definition

 

 

To Create the UDT from OPC Browser

In the example here, we will use a ControlLogix which supports UDTs. We will use the second method from above that is, creating the UDT from OPC. In our ControlLogix PLC, lets let's say we already have a motor UDT setup and now we will create the UDT in Ignition.

  1. From Tags Browser, click the OPC Browse icon.
     
  2. Under the CLX folder, go to the Global folder and find the M1 folder.
    M1 represents a motor which has four tagsTags: AMPS, HOA, RUN_CMD, and STATUS.

  3. Drag the M1 folder to the Data Types folder in Tags Browser.
    A window prompts you asking if you want to create a type or tagsTags.


     
  4. Click on Create Type.
    The Tag Editor window is displayed. Notice all four tags Tags; AMPS, HOA, RUN_CMD, and STATUS are automatically part of the UDT.
     

  5. In the Tag Editor, change the name from M1 to Motor to make the type name more of a generic name.

  6. Right now each tag Tag is pointing to a specific address in the PLC, select the AMPS tag  Tag to see that it is pointing to M1 in the PLC.



    Because we are creating a UDT, we don't want to point to one specific set of tagsof Tags. We want each instance of the UDT to reference a different set of tagsTags. To do that, we need to add a parameter to the UDT.
    Parameters  Parameters are custom properties on data types. You can use the parameters inside the type or instance definition to create parameterized data templates.

    For example, if a data type consists of three OPC tags Tags that only differ by a number in the path, you can use a parameter for the “base address”address, allowing " allowing instances to be created with only one setting.
     

  7. In the Tag Editor, select the Motor data type and add a new parameter by
    clicking the green + button and setting the following:
    Name: MotorNumber
    Data Type: String


     

  8. Click OK.
    Now  Now for each tagTag, we can substitute the motor number with the MotorNumber parameter.
     

  9. Open the Tag Editor again, select the AMPS tag Tag. In the OPC Item Path, click on M1 and press Ctrl-Space to bring up the list of parameters, click MotorNumber to replace 1 with {MotorNumber}.

     


  10. Do the same for the HOA tag.
    The  The OPC Item Path will then show:
    [CLX]Global.M{MotorNumber}.HOA
     

  11. Click OK to save the UDT.
    You  You will see the Motor UDT in the Data Types folder.


     

On_this_page 

Scroll HTML Exporter Ignore Iulink
URLhttps://www.inductiveuniversity.com/video/creating-udt-definition?r=/course/tags
NameCreating UDT Definition

 

 

 

 

To

create a new data type manually

Create a New Data Type Manually

  1. Simply select the Tags folder in the Tag Browser.

  2. Click the Tag icon on the Tag Browser toolbar.
     The tag Tag creation menu is displayed.
     
  3. Select New Data Type from the menu.
    The  The 
    Tag Editor is displayed.
    When editing complex tagsTags, the Tag Editor window appears a bit differently. The member tree structure is presented in the upper left. By selecting a member, the tag property Tag property categories are displayed below the member area, and the editor for the selected category appears to the right.

To

extend other

Extend Other Types

Data types can extend other data types, to add additional members, or override default values. The parent data type can be modified by selecting the data type itself in the tag Tag member tree. Note, that the data type can only be selected when the tag Tag is first created. After that, it is not possible to modify the parent tag Tag type.

To

add members

Add Members to a

data type

Data Type

Simply click the green + icon at the toolbar above the member tree. Data types can contain standard tags Tags like OPC and DB, as well as folders and instance of other complex types.

To

add parameters

Add Parameters

Parameters, which can be used for property expansion in member tagsTags, can be added by selecting the data type in the member tree. If a data type contains other complex types in it, there may be various points in the tree with custom parameters. While a data type can override the parameter values inherited from a parent, new parameters can only be added to the root node of the new data type. 

Configuring Member Properties

The tags Tags inside of data types are configured much like normal tagsTags. However, in this case, the values can be thought of more as "default values", which will be used unless other values are specified when the instance is created. Most of the values configured in the data type can be modified later in sub types subtypes or instances. Furthermore, unlike normal tagsTags, in the context of a data type many properties (general the string based properties) can reference the custom attributes of the type in order to build parameterized types.

Attribute Referencing and Parameterized Types

As mentioned above, many properties in the member tag Tag configuration can reference the parameters available in the data type. When instances are created, these references are replaced with the values defined for the type. Parameter references also support basic offsets and numerical formatting, providing a great deal of flexibility. To reference a parameter, use the syntax {ParameterName}, or use Ctrl-Space to display a list of available parameters to choose from.

To offset a value, use the form {ParameterName+offset}.
To format a value, use the form {ParameterName|format}. The format pattern is the same as that used for the numberFormat expression function. In short, "0" can be used to require a digit, and "#" can be used for optional digits.

Example:

For this example, we'll assume that we're parameterizing the OPC Item Path, and that the data type has an integer attribute named BaseAddress defined. We'll pretend the OPC Server provides tags  provides Tags named like DataPoint1.

Standard referencing

OPC Item Path: DataPoint{BaseAddress}

Offset

Imagine that our data type had three fields, and these were laid out sequentially in the device.
Instead of specifying each address for each tagTag, we can simply offset from the base address:

Member 1: DataPoint{BaseAddress+0}
Member 2: DataPoint{BaseAddress+1}
Member 3: DataPoint{BaseAddress+2}

Formatting (with offset)

Continuing from the example above, imagine that our OPC server actually provided addresses in the form DataPoint001, in order to stay consistent up to "DataPoint999". This can be accommodated
using number formatting in the reference:

Member 1: DataPoint{BaseAddress+0|000}
Member 2: DataPoint{BaseAddress+1|000}
Member 3: DataPoint{BaseAddress+2|000}

This format of three zeros means "three required digits". If our instance has a base address of 98, the resulting paths will be DataPoint098, DataPoint099, DataPoint100.

Properties that can be

parameterized

Parameterized

The following tag Tag properties can reference parameters:

  • Value (for string data type only)
  • OPC Server
  • OPC Item Path
  • Tooltip
  • Documentation
  • Expression/SQL Query
  • Bindable Alarm Properties (Note: you can bind a property directly to the parameter, or use parameters in the binding expression, or directly in string property values)

Overriding Properties

Sub types Subtypes and instances can override the properties defined in parent types. To do this, simply select the override control (the small grey ball) next to the property to override in the member editor.
Conversely, to remove the override, simply unselect the control.

Custom parameters can be overridden as well, but it is not required to specify that the value is an override. Simply provide a new value for the property. For inherited parameters, the delete button next to the parameter table will simply remove the override. The parameter can only truly be delete from the type that defines it.

 

Pre-Defined Parameters

UDTs have a few parameters already defined to make things easier for you. They give you access to the name and various paths associated with a UDT member Tag. These parameters can be accessed from anywhere in a Tag that a normal parameter can be used. Each of these parameters uses that Tag it is in as a starting point for it's path.

Parameter NameDescription
{InstanceName}The name of the UDT Instance that this Tag is inside.
{PathToParentFolder}The full path to the folder that this Tag is in.
{PathToTag}The full path to the Tag using this parameter.
{RootPath}The full path to the UDT instance that this Tag is in.
{TagName}The name of the Tag that is using this parameter.