Introduction to ControlLogix UDTs
ControlLogix UDTs are User Defined Data Types. User Defined Data Types allow us to create a data structure for a particular part of our system. We can then use that data structure throughout our project. Examples of where we might use a UDT would be when we have multiple motors, pumps, or valves in a project.
Data types are just “Menu Items”. When you walk into a restaurant, and order a #1 Value meal, the cashier knows exactly what you want. You don’t have to specify each item individually. It’s the same with Data Types. When you create a tag, and give the tag a data type, Studio 5000 knows exactly how to structure that tag.
Before we get into UDT’s, let’s take a look at a pre-defined data type that you already understand. The timer data type is already defined by default in a project. The timer is PREDEFINED. When you create a tag, and give it a timer data type, it’s data structure includes the EN, DN, TT, ACC, and PRE values.
An example a USER DEFINED data Type would be a valve. We might have ten valves in our system, and each valve would have the same data structure. Each valve would have an Open and Closed limit switch, Open and Closed Solenoid, fault bit, fault timer, etc. Instead of creating each individual tag for every valve, we can create a valve data type. Then any time we need to use a valve, we can name the valve, and give it the valve data type. The tag would then inherit everything we need for a valve.
Here is what we might end up with for a tag with a Valve data type after it’s been created: (We’ll create this type in the steps below)
Creating the ControlLogix UDTs
To create the UDT, right click the “User Defined” folder (in your Controller Organizer window) under “Data Types”. Then select “New Data Type”.
Next, we’ll name the Data type “Valve” and add the members that you will need for each valve. If you have different types of valves, such as an MOV (Motor Operated Valve), or a positioning valve, you may want to create a different UDT for each type. Our example is a simple solenoid valve.
Note: If you also add a description to each member, this description will also carry over to the tags we create. Here we will keep this simple though for the purpose of understanding the structure itself.
Be sure to press “Apply” and “OK” to accept your new data type. Next, we will go to the controller tag database, and utilize the data type that we just created. Create 3 tags: Suction_Valve, Discharge_Valve, and Bypass_Valve. Each will have the “Valve” Data type.
Now, you can go to “Monitor Tags”, and expand each tag. You will see that all the information we need about any of our valves is all in one place.
Mapping the tags
These tags don’t cause anything to happen in the real world as they are. They are “User Friendly” tag names though. We need logic to map the discrete I/O (such as Local:5:I.Data.0) to these tags. Once we map the Discrete I/O tags have been mapped into these “User Friendly” tags, we can use them in logic.
Here is an example of mapping:
The advantage of using this method is that all of the data for each valve is in one place. If the troubleshooter has a problem with a valve not opening for example, he will just find the tag for this valve. Then he can cross-reference the open solenoid, to start tracing through logic to find out why the valve did not energize.
Summary of ControlLogix UDTs
In short, we use ControlLogix UDTs to create a user defined data structure. It’s up to you as a programmer to move data into and out of this data structure. Think of UDT’s as a “Menu Item”. Just by creating the UDT, you are not using it anywhere. Once you create a tag, and give it the data type of the UDT you created, it will be available for use by your program.
In other words, if you walk into a restaurant, you see a value meal on the menu. You don’t have any meals until you order them. When you create a tag with that data type, you are “ordering” an instance of that data type.. You can create as many tags as you like with this UDT within the limitations of the processor’s memory.
For other information on ControlLogix, please visit the ControlLogix Post page!
— Ricky Bryce