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

LESSON LIST

Autoplay Off

Description

Learn how to configure UDT inheritance, and create parent and child UDTs.

Video recorded using: Ignition 8.0

Transcript

(open in window)

[00:00] One novel way of varying the structure of a UDT to more closely match the specifics of your setup is to use UDT Inheritance. UDT Inheritance is a feature available when designing UDTs that allows us to base the starting structure of one UDT off of another. To demonstrate, I've got a Turbine UDT here. And it's working just as expected. I already have an instance set up here. Now let's say I want to create a new kind of Turbine UDT, but I want to start with the work we've already done here. That would make this a good candidate for UDT Inheritance. So to create our new UDT, I'm going to right-click on Data Types, and under New Tag, I'm going to select New Data Type. And the name of my new Data Type is going to be Controlled Turbine. Basically I want to create a kind of Turbine UDT that has a status tag I can write to to control the turbine. So in order to configure Inheritance here, under the Parent Data Type property I just have to go to the drop down and select my Turbine Data Type. And now we can say that my Controlled Turbine UDT is inheriting from the Turbine UDT. So I'm just going to click OK. And now if we expand my Controlled Turbine UDT in the Tag browser, we can see that it already has the power and rpm tags that the parent UDT has. Now there's not much point in creating a UDT that's identical to my first one, so let's go back into my definition. I'm going to right-click on my UDT, and go to Edit Tag. And now let's add a tag. So I'm going to come up here, expand the drop down, and under New Standard Tag, I'm going to select OPC Tag. And then I'm going to select my New Tag. And let's just call it Status. Again, my goal for this Controlled Turbine UDT is that I can control it. So that's what this status tag is for. So now I just need to pick the right item path. So I'm going to click the icon next to OPC Item Path. I'm going to browse OPC. Going to expand Ignition OPC UA Server. Devices. Generic Simulator. We're just using a simulator for this example, so the actual OPC item we use might not make much sense. I'm just going to expand Random, and select RandomBoolean1. And then I'm going to click Commit. And that'll get us most of the way. I actually want that OPC item path to be dynamic based on a parameter, so I'll click the icon again. This time I'll go to Edit. And this time I'll replace one here with the parameter. And the parameter I'd like to use is TurbineNum. So that's all it takes to configure the status tag I'd like to use. I'm going to click Commit. And now before we test this out, I want to note one other thing about the structure in here. If I select one of the tags that already existed on the Parent UDT, rpm for example, we'll note that we have the ability to override many of the properties of these tags. I don't feel like changing anything now, so I'm just going to click OK. And now we can see our status tagged on the Data Type. So, let's create an instance of our Data Type. I'm going to right-click on Tags. I'm going to come down and under New Tag, I'm going to select Data Type Instance. And then Controlled Turbine. And how about we just call it Test Turbine. And let's configure the TurbineNum parameter. Again, we never specified this parameter on the Controlled Turbine UDT. It all stems from the Parent UDT. So let's set a TurbineNum of two. And click Commit. And click OK. And now if we expand our New UDT Instance in the tag browser, we can see that all three tags are working as expected. So just one final note on UDT Inheritance. If we create any UDT bindings in vision or perspective, all UDTs with the same base type can be used interchangeably in the binding. This can make it really easy to build flexibility into your Ignition project.

You are editing this transcript.

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

close

Share this video