You are on page 1of 5

Add On Instructions, Embedding, and Parameter Passing

This is a short document explaining the simple features of Add On Instructions, embedding those
instructions into User Defined Datatypes, and passing parameters with them.

First start with creating a new AOI to perform a task.

Next you will configure the parameters. These can be Input, Output, and InOut. For this example we will
only be using Input and Output.

Be sure to give the parameters meaning, but non specific names. These will be added to a base tag
name that will define the unit or equipment.
Next I have added some local tags. These are similar to the difference between controller tags and
program tags. The local tags cannot be accessed outside of the instruction. For these I typically create
timers, one shots, or temporary, virtual tags.

Now we see the logic in the AOI. This is a simple pump control circuit that can be used over and over
again. This will be the base code used for each unit that uses the AOI.
Now we will go a step further and create a User Defined Datatype called BasePumpCode. In this we will
add the SimplePumpStarter we created and also add some AlarmAnalog AOI’s that were created
previously. The AlarmAnalog has been dimensioned to 10 to create 10 alarms in the UDT.

Now create a controller tag with Data Type of the UDT we created BasePumpCode.

See all the tags that are automatically created.


Now we drag the AOI’s into a subroutine and assign the parameters. Note how rung 0 uses the
Permissive input tag that was created in the AOI. The rest of the parameters are entered directly in the
block from this view. Also note that the input parameters can be direct referenced from the HMI / Scada
so no additional logic is needed to start, stop, etc.

Basic functions are another good use of AOI’s.In the next example the AOI is taking an array of stored
values for Inputs, checking for valid readings, averaging them, then outputting this to Average.
The array is dimensioned to 500 in this example to allow plenty of room. The SampleCount input
parameter is where you enter the actual max limit of the array.

Other good uses of AOI, UDT, and embedding are…

- Conveyor control
- PID / PIDE
- Indirect addressing
- Hourly production reporting
- HMI animation
- Machine control
- Valve control
- Any code that is repetitive

You might also like