What is the difference between a AOI and a UDT in RS Logix 5000 ?

Good Evening ,

I still have many "Mental Blocks" when it comes down to programming. Could you tell me the difference between a UDT and a AOI , and why would they be used ? I understand the AOI , a little . I guess it is a pre-canned code that you know that works , and you insert that into your code without re-writing it , correct ?

What is the purpose of a UDT , and it's benefit's ?

Thanks so much in advance.

The names explain themselves. User-defined Date Type; Add-On Instructions.
 
Simple example:

Timers and Counters are UDTs (system defined). RSLogix 5 and 500 had them.

RSLogix5K allows you to create you own.

AOIs are the next step - attach code to your UDT.

Timers and counters are not UDTs, they are Instructions.
AOIs can be created using system data type or UDT, you don't have to use UDT to create AOI.
AOI and UDT are 2 different things.
 
Last edited:
I think you are reading his post a little to literally. jstolaruk is not wrong or backwards. Perhaps he omitted an explanation of what he meant.

A timer/counter is a pre-defined data type. There are timer type tags and there are counter type tags. It isn't really User-defined, but the concept is the same. They are data structures with defined elements. I used to explain UDTs in my classes by comparing them to the pre-defined data types like timers and explaining that you could build your own structures and mix and match data types just like the timers do. Create a timer tag and you automatically get all the elements. Create a tag using a UDT and you get the same result. Timers were always an excellent example for me to explain what UDTs were.

But of course Timers are also pre-defined instructions. Those pre-defined instructions have backing logic that makes them tick. Again, similar in concept to an AOI, but pre-defined. The difference today is that an AOI includes its own data type (UDT). Which is exactly what timers and counters do.

So yes, if I were comparing timers and counters to UDT and AOI, I would say they were more like the AOI. But I absolutely understand the comparison to UDTs when looking strictly at the data.

OG
 
So yes, if I were comparing timers and counters to UDT and AOI, I would say they were more like the AOI. But I absolutely understand the comparison to UDTs when looking strictly at the data.

OG

Agreed, but OP asked specifically for the difference between the two. Of course, within the AOI there is a UDT that holds the tags used within the AOI.
 
I think you've got it backwards here. Timers and Counters are system defined AOIs, not UDTs. They're AIOs because they have logic "baked-in" for the output parameters once you provide your input parameters.
Timers and counters are not UDTs, they are Instructions.
AOIs can be created using system data type or UDT, you don't have to use UDT to create AOI.
AOI and UDT are 2 different things.
The timer instructions (TON/TOF/RTO) are comparable to AOI, except they're system-defined, not 'add-on'. And just like AOI they have an associated data type, TIMER, that is somewhat like a UDT (except, again, system-created rather than 'user-').

Same with CTU/CTD and the COUNTER data type.

jstolaruk presumably meant the data type (you know, the ones actually called 'timer' and 'counter') and so was quite correct.
 
Agreed, but OP asked specifically for the difference between the two. Of course, within the AOI there is a UDT that holds the tags used within the AOI.

Yes, but OP posted that question four years ago. I don't think he was hanging on waiting for a further explanation. He received several very good descriptions and never replied to any of the comments.

OG
 
Throughout this 4+ year-old thread, there has been a fair amount of inaccuracies and misconceptions about AOIs and UDTs.

Let me try to clear up any confusion people may have....

Neither AOIs (Add-On Instructions). nor UDTs (User-Defined Data-Types) exist in any PLC or controller you buy from Allen-Bradley. Both have to be created by the programmer. There is absolutely NO tie-up with AOIs and UDTs, they are as different as chalk and cheese.

An AOI is a mechanism that allows the programmer to enhance or extend the capabilities of the built-in instruction set, and it does this by way of building what appears to be a PROGRAM, and places that in the "Add-On Instructions" section of the organiser. You can make a "call" to the code of the AOI from anywhere in the main code of the application, or from any other AOI. The programming software puts the AOI on the screen just like any other of the built-in instructions.

That AOI "program" will, by default, have a routine that is executed whenever the AOI is TRUE, but you can create another routine that is executed instead when the rung that the AOI is in evaluates as FALSE. This can be used for housekeeping the data that the AOI uses, resetting flags, timers, counters etc. This "Enable-In False" routine is not mandatory, but you may NEED one to ensure correct operation of the AOI logic.

Another routine you can create within the AOI is the Pre-Scan routine. If enabled, this routine may be used to intialise the data within the AOI to a known state. Without the pre-scan routine, the data tags associated with the routine will be determined by its last execution,m which may not be acceptable for a controller restart.


A UDT is a mechanism that allows the user to create his own Data-Types, enhancing and extending the range of pre-defined data-types available by default. You can build your own UDTs that are more "amenable" to the application.

An example (from my background) could be a "Recipe" for beer-brewing. Different beers will have different quantities of ingredients and additives, and can be processed with different "parameters". All of the data in a Brew Recipe, which could be 100's of values, of a mixture of data-types, has to be moved with the brew it belongs to from one stage of the brewing to the next (beer-making is a batch process, involving several stages in the "brew-stream").

Moving that data used to be a long-winded process, because of the different data-types. By creating a UDT of the recipe, you can then create "containerised" structured tags that can now be easily "moved" from one process to the next, using COP or CPS instructions, or even produced and consumed by another PLC (messaging might be required if the Brew tags are over 500 bytes, which is highly likely).

Another great "feature" of UDTs is that the "members" of them are named, so using them as templates for recipe tags makes the code easily readable, e.g. the parameter specifying the feed rate of Malt into the Malt Mill might be "Carling.Milling.InfeedRate".

In summary, AOIs and UDTs are not tied together in ANY way. You can use AOIs with or without UDT tags, the choice is yours. You can use UDTs with or without AOIs, again the choice is yours.

Hope this helps someone ....
 
Neither AOIs (Add-On Instructions) nor UDTs (User-Defined Data-Types) exist in any PLC or controller you buy from Allen-Bradley. Both have to be created by the programmer.
- Correct


There is absolutely NO tie-up with AOIs and UDTs, they are as different as chalk and cheese.
- Incorrect

UDTs and AOIs are similar with respect to the structure of the data they hold. An AOI contains a UDT. Hence, why it's a UDT with code attached. Take any AOI and you could make a UDT and then write code that would function exactly the same as the AOI would have.

Of course no PLC ships with AOIs or UDTs, hence the names add-on instruction and user-defined type. They're added-on and defined by users. We were simply using an included instruction (TON) to demonstrate the difference using a familiar instruction. As stated, the TON is a system defined AOI. Yes, it's not an add-on instruction, but it is closer to an add-on instruction than XIC/XIO.


You can make a "call" to the code of the AOI from anywhere in the main code of the application, or from any other AOI.
- Incorrect

You do not make a call to an AOI. AOIs are more like classes with pre-defined methods than they are like functions. An instance of the AOI is required in order to use it's methods.


You can use AOIs with or without UDT tags.
- Kind of

Once you make an instance of your AOI this basically becomes a UDT.


You can use UDTs with or without AOIs
- Of course

, but there's not as many useful applications of only UDTs. In most cases (duplicate devices with identical behavior, for example) an AOI is much more useful.
 
You've pulled me up on a couple of things, but I am going to stand my ground.

A UDT is a User-defined Data Type - period. The UDT defines the structure of the data container, nothing else. You can make a UDT and use it to create tags of that structure. Nothing to do with AOIs.

An AOI will create a tag database based on the In and Out parameters you specify, but this is NOT a UDT, totally different. An AOI tag collection may, or may not, contain UDTs, so when you say the AOI creates UDTs you are totally mistaken.
 
An AOI will create a tag database based on the In and Out parameters you specify, but this is NOT a UDT, totally different.

The AOI creates a data type whose contents are defined by the user (+ EnableOut and EnableIn). You can make an AOI and then create tags of its data type structure.

That's not 'totally different' from a UDT; in terms of content and structure it's almost exactly the same.
An AOI tag collection may, or may not, contain UDTs,
A UDT may or may not contain other UDTs, and a UDT may or may not contain data structures created by the AOI.

Again, no real difference to speak of.
so when you say the AOI creates UDTs you are totally mistaken.
This exact wording is indeed technically incorrect, since the data type created by an AOI is not called a UDT even though it basically is one. But that's mere sophistry; the major difference between the data type of an AOI and a UDT is that the AOI is forced to contain EnableIn and EnableOut bits.
 

Similar Topics

Good Evening , I’m probably entering the most challenging stage of programming I have ever attempted . It is probably easy , and easily...
Replies
8
Views
4,102
Hello, I have a problem with AO- and AA-Tags. When I use for example the tag AO_Test with the address 200 and type the value 1,2 in, the AA-Tag...
Replies
7
Views
1,415
As per the title. This might seem like a basic question to many, but I'm unclear about the difference between a coil ( ) and an application...
Replies
28
Views
4,046
Good Morning , I have 2 Frequency Drive panels to build and commission . It is for 2 pump systems . Just wondering , what is the...
Replies
4
Views
1,973
Hi Experts, Good day! What are the differences between PCS7 SIMATIC Batch and PM Control? Do you have any manual like "Getting Started "...
Replies
0
Views
817
Back
Top Bottom