This lesson is part of the Tags in Ignition course. You can browse the rest of the lessons below.


Autoplay Off


Learn how to configure sub-UDTs inside of an outer UDT.

Video recorded using: Ignition 8.0


(open in window)

[00:00] When configuring UDTs, Ignition offers us the ability to add a UDT as a member of another UDT. That is, we have the ability to nest UDTs. This can be particularly useful when working with large or complex UDTs, or when we have a few UDTs that we'd like to combine into one. So, for example, here I created two data types. One called Tank, and one called Turbine. And if I expand the definitions here, we can see they each have their own member tags. And in fact, they each take a parameter to point these OPC tags at the correct addresses. For Tank, the parameter is called TankNum and for Turbine, it's TurbineNum. So now let's say that I'm designing a project for a facility that has many stations, and each station consists of one Tank and one Turbine. I'm going to go about creating a station UDT with these Tank and Turbine UDTs as members. That is, I plan on nesting them inside of the station UDT. So, to configure that, let's create a new data type. So I'm going to right-click on Data Types. Come down, and under New Tag, I'm going to select New Data Type. The first thing that we'll need is a name for our type, so I'm just going to call it Station. So I actually want the Station UDT to take a parameter because there are many stations and each UDT instance will only represent one of them. So, next to Parameters I'm going to click the icon. And then I'm going to hit the plus icon to add parameter. And let's just call it StationNum. And I don't need to set the value inside the definition, it'll be set on each instance of the UDT. So I'm just going to hit Commit. And now we can add UDT instances inside of this UDT the same way we would add any other tags. So I'm going to select this drop down here, next to the add tags icon. And then just like we would add a standard tag to our UDT, I'm going to add UDT Instance. And let's start with the Tank. So I'm going to select the instance I added, and I'm going to set it's name to Tank. And remember the Tank UDT does take a parameter. I can see it if I click the icon, here. So rather than specifying this TankNum parameter on every instance of the Station UDT, I want to simply pass it in from the outer UDT. Now I can make our lives really simple here, by saying that this TankNum parameter should always be equal to this StationNum parameter in the outer UDT. This means that when I specify a StationNum on the outer UDT, this inner UDT will have it's TankNum specified as well. So to configure this, I'm going to specify a value for the TankNum parameter. It should simply be StationNum. Note that when we're referencing a UDT parameter, we need to include it in curly braces like this, but that's all we have to do to pass a parameter from the outer Station UDT into the inner Tank UDT. So I'm going to hit Commit. So now let's do the same thing for our Turbine UDT. So I'm going to select the root of this Type Structure. And then I'm going to go back into my dropdown, here. And I'm going to add a New UDT Instance, and this time it will be Turbine. Then, I select my New Instance, change its name to Turbine. And then, just like on the Tank UDT, I want to specify the TurbineNum parameter. So I'm going to click the Parameters icon again, and again, I'm going to pass in the StationNum parameter. That's all it takes, so I just hit commit, and in fact, we're done with this UDT definition. So to summarize, we configured an outer UDT, added in UDT Instances for our other UDTs, and then configured a StationNum parameter to be passed through to each of these nested UDTs. Now all we have to do to create our Data Type, is hit OK. And we see that the Station Data Type has appeared. So to create an instance, I'm going to right-click on Tags, come down and under New Tag select Data Type Instance, and then select Station. And let's just call this Station 1. And then let's specify the StationNum parameter. So clicking the parameter icon again. And let's just set a value of one. Then, we'll hit Commit. And then OK. We can see that our UDT instance has been created, and if I expand it, and then I expand the Tank and Turbine instances, we can see that all the values are coming through successfully.

You are editing this transcript.

Make any corrections to improve this transcript. We'll review any changes before posting them.


Share this video