Tag Based Memory Structures

Tag based memory structures are what most new generation
PLC/PAC's use. A tag is a friendly name for a memory
location. This tag name also has a data type assigned.

In this section we will use the Allen Bradley ControlLogix
PAC. Refer to the manufacturer manual for other PAC brands.

AB ControlLogix Tag Based Memory Structure

As stated earlier, tags are the same as variables used in
languages such as C++, VB.NET or Java. Tag names should be
assigned that are descriptive to the data being stored in
them. Example of tag names could be:

Start_PB

Could be a tag name for the start push button
of a process.

Vessel01MixMotor

A tag that could be for the mixer motor on
process vessel 01.

_furnaceTemp

A tag name that could be use to store the temperature
value read in a furnace.

Tag Naming Rules

There are several rules that must be followed when creating
tag names.

Tag names must begin with a letter or an underscore
but can not end with an underscore.

Mixed case is used for ease of reading such as: Conveyor_2 or
Conveyor2 and not CONVEYOR_2 or CONVEYOR2.

When viewing tags in the RSLogix 5000 software the tags
will be displayed in alphabetical order. Use this to
your advantage when naming tags. Using the same word to
start tag names from the same process areas will keep
them grouped together. As an example:

Conveyor2_motor

Conveyor2_inputSensor

Conveyor2_endOfConveyor

would keep all the tags associated with Conveyor2 grouped
together.

When a tag is created it must be assigned a data type. The
basic data types are 'basic' and 'structured'. The following
tables outline the basic data types and the most commonly used
structures.

ControlLogix Project structure

Before continuing with tags, data types and structures, it is
important to understand the structure of a ControlLogix
project. ControlLogix projects consist of Tasks, Programs and
routines. The following is a graphical representation of a
ControlLogix project. Refer to this graphic during the following
descriptions.

ControlLogix project structure

Project

A ControlLogix project (the large light blue box in the
ControlLogix project structure graphic
above) contains all of the elements that make up a program.
Everything required for the program to function is contained
within the project.

Task

There are two types of tasks: continuous and periodic.
Every project must have one continuous task and it can be the only
continuous task in the project. A project can have upto 32-tasks. A
task is associated with a progarm and has two functions:

It holds information necessary to schedule the programs
execution.

It sets and determines the execution priority for one or
more programs.

As stated above there are two types of tasks, continuous and periodic.

Continuous task

A continuous task is represented by the white task box in
the ControlLogix project structure graphic
above. Continuous tasks execute non-stop. Every
project must have, and can have only one continuous task.

Periodic task

The other tasked in the above grapic would be periodic tasks.
A project does not require periodic tasks. A project only
requires a continous task. Periodic tasks interrupt the
continous task and execute for a precribed length of time and
specific time intervals. When the time expires, the task
executes one last time. Periodic rates can be from 1ms to
2000 seconds. The default period is 10mS.

Program

Each task requires at least one program. A task can have up to
32-programs. Only one program can execute at-a-time.

Routines

Routines are where the executable code resides. Routines can
be written in:

Ladder Logic

Sequential Function Chart

Function Block Diagram

Structured Text

or a combination of all.

There are two types of routines:

Main routine

Subroutine

Main Routine

When a program executes the main routine executes first.
The main routine is used to call(execute) other
routines in the program (subroutines).

For those who are familiar with the AB SLC500 or PLC5, the
main routine is the same as LAD 2.

Subroutines

Any and all additional routines within a program are called
subroutines. Subroutines are used to keep programs organized.
They contain executable code, just like the main routine and
can be written in any of the 4-languages listed above.
Subroutines will only execute when they are called from
the main routine or from another subroutine.

An example for the use of subroutines could be: An assembly
area uses a rotary indexer that has 10-different assembly
stations. There can be 10-subroutines with each subroutine
containing the program code that controls one of the
assembly stations. These subroutines are called from the main
routine or from other subroutines. If the product being
produced does not require the 10-assembly stations, the
subroutine call to the assembly station(s) not required can be
disabled and that/those stations will not be included in
the process.

Tag Types and Scope

There are two types of tags:

Program tags

Control tags

Program Tags

The program tags are represented in the purple box in the
ControlLogix project structure graphic above.
Tags that are used within a program are stored in that program and
have a scope of that program. Scope will be
discused later.

Controller Tags

Controller tags are represented in the white box in the
ControlLogix project structure graphic above.
Controller tags are global tags. Globa tags are tags
that store values available to the entire project. I/O data
and system-level and system-shared data are examples of
global tags.

Tag Scope

The scope of a tag is where and when the data stored
at the location in memory referenced by the tag is available.
Some languages call scope, lifetime.

The data in a program scoped tag is only available when that
program is executing. The tag and its data are not
available to any other program. When the program stops
executing and transfers control to another program the
tags in the stopped program are no longer available.

Program level tags assist in keeping data organized and
also assists in security by providing data hiding.

The following figure is a screen shot of the Rockwell
Automation RSLogix 5000 project window that shows the tree
structure of an RSLogix 5000 project.

RSLogix 5000 Project Window

Tag Type Classifications

There are two tag classifications:

Base tag

Alias For tag

Base Tag

All instructions are assigned a base tag. The base tag
is a tag name that represents the process function and
is assigned a data type appropriate for that function.

As an example: A mixing vessel on the north side of the
plant might have a base tag name; North_Vessel_Mixer and
if this tage is being used to turn on/off the mixer
motor it would assigned the data type Bool (0 or 1).

Alias For tag

An Alias For tag is another name for a base tag. I/O
points are assigned to base tags using an Alias For
to the I/O module point.

If the mixer motor controller is wired to an output module
in slot 2, terminal 14, the I/O point would be assigned
using an Alias For tag. Therefore, the base tag:
North_Vessel_Mixer would be assigned an Alias For tag of:
Local:2:O.Data.14

I/O Tag Format

The form for a physical address in the AB ControlLogix
processor is:

Location:Slot:Type.Member.Submember.Bit

Location

The location specifies the network location for the data.

Local is used if the I/O module is in the same rack
as the processor module.

An adapter name is used to identify a remote communication
adapter such as a DeviceNET remote I/O block.

Slot

The slot is the slot number the I/O module is plugged into.
Slot are numbered with slot 0 being the first slot
on the left side of the rack and continues counting up by
1 going to the right.

Type

The Type specifies one for four types of data:

I for inputs

O for outputs

C for configuration

S for status

Member

Member specifies the type of data that the module can store.
Digital (discrete) I/O modules use a DATA member. Analog I/O
modules use a Channel Member (CH#)

Submember (Optional)

A submember is specific data related to a member. More on this
later.

Bit (Optional)

The bit number specifies a bit number for an internal
instructions or a screw terminal for I/O modules.

Delimiters

Only two delimiters are used; Colons (:) and periods (dots)(.).
If an address is a control-type tag, a (C) is placed at the end
of the address to indicate that the tag is a controller scoped
tag.

Example: if a base tah is assigned to a start push button on
process 1, that is wired to the input module in slot 7, screw
terminal 8, and if this input module is in the same rack as the
controller, the base tag might be: