Four valves, each with the same data and the same three steps of logic. In Studio 5000, do you build a UDT or an AOI? We build both designs on one example and compare what each one packages, where the data lives, and how many places you change when the logic changes. Advanced level.
The valves, tag names and logic are our own example, not a Rockwell example or a real program.
Watch first: Why good Logix logic never runs: tasks, programs, routines https://youtu.be/-ApmtXGiPsE
Watch first: Bits, INTs, DINTs, and REALs: choosing a PLC data type by range https://youtu.be/IH6CTj2IVQY
The UDT design (our example): UDT_Valve is a user-defined data type with six members, TravelTmr (TIMER), Cfg_TravelTime (DINT), Cmd_Open, Inp_OpenLS, Out_Open and Sts_Fault (BOOL), ordered by the manual's member-order guideline for when memory use is a concern: like types together, largest to smallest (RM094N p. 60). Four tags of that type, Valve_1 to Valve_4. The logic stays in rungs, written once per valve: 3 steps x 4 valves = 12 rungs, so a change to the travel check is made in 4 places.
The AOI design (our example): ValveControl_AOI has the Inputs Cmd_Open, Inp_OpenLS and Cfg_TravelTime and the Outputs Out_Open and Sts_Fault; in our design the travel timer TravelTmr is a Local tag. The three steps are written once, in the definition, and called four times. Each call has its own instance tag of the instruction's data type (Valve_1 to Valve_4 : ValveControl_AOI). The parameters show as members of that tag; local tags are not available as members (Logix Designer help v37). The manual: "Make changes once to the Add-On Instruction definition to affect all instances." (p. 63). Parameter names use the prefixes the manual prints (p. 56).
Rockwell's code reuse guidelines (RM094N p. 53): "Use user-defined data types (UDTs) to group data." "Use Add-On Instructions to create standardized modules of code for reuse across a project." Use an AOI to encapsulate specific or focused operations, such as a Motor or Valve action; a Conveyor or Tank action is better managed as a routine.
Our rule of thumb (ours, not Rockwell's): repeating the same data layout, build a UDT; repeating the same logic, build an AOI. Often both: Input and Output parameters are atomic, so a UDT goes into an AOI as an InOut parameter, passed by reference (p. 63).
Chapters
00:00 Intro
00:15 The UDT design
02:04 The AOI design
03:39 When the logic changes
04:23 Rockwell's guideline
05:12 Often both
05:44 Recap
Sources
- Rockwell Automation, Logix 5000 Controllers Design Considerations Reference Manual, 1756-RM094N-EN-P, September 2025: Guidelines for Code Reuse p. 53; Parameter Name Prefixes p. 56; Guidelines for User-defined Data Types and UDT Member Order Impact p. 60; Guidelines for Add-On Instructions p. 63; Comparison of Subroutines and Add-On Instructions p. 64 (Add-On Instructions column); supported data types p. 83. Chapter 6 (pp. 53-64) applies to ControlLogix and GuardLogix 5590, 5580, 5570; CompactLogix and Compact GuardLogix 5380, 5370; CompactLogix 5480. Literature Library: https://www.rockwellautomation.com/search/ra-en-US;keyword=1756-RM094;activeTab=Literature
- Rockwell Automation, Studio 5000 Logix Designer online help v37.00, Using an Add-On Instruction (with the glossary entries input parameter and InOut Parameter): https://www.rockwellautomation.com/en-us/docs/studio-5000-logix-designer/37-00/contents-ditamap/studio-5000-logix-designer/add-on-instructions/using-an-add-on-instruction.html
- Rockwell Automation, Studio 5000 Logix Designer online help v37.00, glossary: Local tag: https://www.rockwellautomation.com/en-us/docs/studio-5000-logix-designer/37-00/contents-ditamap/local-tag1.html
- Rockwell Automation, Studio 5000 Logix Designer online help v37.00, Add-On Instruction Definition Editor Dialog - Local Tags Tab Overview (the term instance tag): https://www.rockwellautomation.com/en-us/docs/studio-5000-logix-designer/37-00/contents-ditamap/studio-5000-logix-designer/add-on-instructions/edit-an-add-on-instruction/add-on-instruction-definition-editor-dialog---loca.html
Help pages read in November 2026; the manual edition is the current one on the Literature Library when checked.
Product names are trademarks of their owners. This channel is not affiliated with Rockwell Automation.
This video is for education.