January 1, 2021

#32 - Rockwell PLC using Added-On Instructions (AOI)

Added-on Instructions, also called AOI, is an important tool for programming Rockwell PLCs. To better understand, we can make an analogy with the functions in Object Oriented programming (OOP) languages, as there are some similarities, such as the ease of reusing code avoiding copy paste, a modular architecture and the parameters that are passed ByValue or ByReference.

In addition, AOIs are easy to export and import (with files of type * .L5X) and it is also possible to strictly control the versions with keying and electronic signature. A limitation that is important to remember is that AOIs cannot be edited with the PLC online. That is why it is essential that tests, validations and version control are carried out before making use. In this post we will do an example of AOI of a treadmill starter motor, which will be instantiated twice as CNV_101 and CNV_102.

By creating an AOI, it is possible to choose the desired language (LAD, FBD, ST), edit the version (Major, Minor)


In the Parameters tab, enter on parameters and choose the usage (Input, Output, InOut). 

One of the differences between usage is the way in which the parameters will be passed to AOI. Parameters of type Input and Output are passed ByValue and parameters of type InOut ByReference. 

Another difference is in relation to Data Types, as Input and Output can be used with INT (SINT, DINT), REAL, BOOL types while InOut can be used with INT, REAL and BOOL but also with Arrays and Struct

This is possible due to the way in which the ByReference pass of the InOut data is made.

In the Local Tags tab, insert the local AOI Tags, which will be accessible within the AOI instance, such as Timers, Counters, One Shots, intermediate calculation results, arrays and bits that store values, etc.

Then do the block logic, in this example a starter motor.

Below a part of the logic used for status and reset in case of failures.

In the program routines, click and drag the AOIs and create the desired instances, in this case two conveyors CNV_101 and CNV_102, in which CNV_102 unloads on CNV_101. In this "waterfall" example, CNV_102 will be stopped when CNV_101 is not spinning.

Note: In the latest versions of the programming software, such as Studio5000 v32, it is possible to directly link the input parameters of the AOI instance with tags of the type Alias ​​of the project, for example. 

Access to the parameters of the AOI instance is done using the dot, for example myAOI jog

Testing the AOI created in all scenarios and modes of use, in this case turns on auto, turns on manual / jog, turns off, fault reset.

Online you can see the real-time status of each instance by right-clicking on the AOI and Open Instruction Logic.

Select the desired instance or main AOI definition:

It is also possible to create a logic block within the AOI that is executed during the prescan of the PLC. This can be useful, for example, to reset elements, positions, etc.

No comments:

Post a Comment