Process Batch Controllogix PDF
Process Batch Controllogix PDF
Introduction
This chapter discusses an important topic, moving of data and large data manipulation programs.
This includes batching applications as well as the labs at the end of the chapter, Simon Says and
Whack-a-Mole.
Modicon, a rival PLC manufacturer to A-B and Siemens, used three simple instructions with
capabilities to move data from tables to a fixed location, from a fixed location to a table and from
a location in a table to the same location in a second table. These instructions were called:
o Table to Register
o Register to Table
o Table to Table
All PLC manufacturers have instructions with capabilities similar to the Modicon instructions.
A-B has a number of different instructions for moving data from a table. The SLC and PLC/5
instruction set used two different techniques for moving data. Siemens uses an indexer and
matrices. The ControLogix language uses matrices and indexing as well. While RSLogix5000
looks very similar to RSLogix 500, the tag addressing scheme is very different as well as the
instructions that perform indexes and moving data using indexing.
In this chapter, we will attempt to discuss the different indexing instructions presently employed
by A-B and Siemens as well as look back at the older indexing instructions used by A-B with
their SLC and PLC-5 processor lines. In addition, we will look at a specification from ISA
called SP88 and some of its methodologies as to how to build a successful batching application.
SP88 will only be discussed here as to how it allows the PLC programmer to build an application
that has the elements needed by the application but in a somewhat standardized way.
Batching systems vary in type and are pictured in the next two figures. The first shows a simple
batch system with various ingredients laid on the transfer belt at programmed rates. The system
here does not include steps but only the process to mix a number of ingredients. More complex
systems include steps after which various activities may occur such as agitation or heating. With
the second figure, this is the case. Various ingredients can be added to a weigh mix tank a step at
a time. This batch system requires the step architecture discussed in this chapter. Both require
recipes. There are advantages to both type. Different processes favor one over the other and
some processes can use both. Obviously the transfer belt does not allow for wet ingredients. We
will discuss the software needed to step through a recipe and the processes to program a batch
with the PLC.
We will be using an example of a simple batching system to discuss indexing and moving of data
and construction of batching systems. The batch we discuss consists of:
As a step is executed, information about the step is collected. For instance, the actual weight
added is found and added to the information already found in the step.
As a step is made, the information about the step including the actual data is saved in a 6 integer
word group with a time stamp in an output table. As a new recipe starts, the time stamp at the
start of the recipe is saved with the recipe number. Then the step information is saved step by
step.
To selectively move a recipe from storage to the active area, with A-B processors, the COP
command is selected. Moving of large portions of data at a time is referred to as a Copy move.
Many times the computer supervising the process will store the many recipes in the computer
memory and copying these recipes into the PLC. An alternative technique would provide the
PLC with only the recipe presently being made and the next recipe to be made leaving only the
two recipes in the PLC’s memory. In general, it is advisable to use the database capabilities of
the computer to control movement of recipes rather than storing and moving large portions of
data in the PLC and occupying the PLCs memory with recipes that are rarely if ever used.
Storage Active
Recipes Recipe
Recipe 1 Step 1
Recipe 2 Step 2
Recipe 3 Step 3
Recipe 4 Step 4
Recipe 5 Step 5
Contacts that are usually defined as one-shots are selecting large data blocks to be moved. In the
example, B3:2/1, B3:2/2, B3:2/3 are selectively picking recipe 1, 2, or 3 to move to the active
region to make one of the three recipes the active recipe. The active recipe storage area is in area
N7 starting at word 10 and having length of 64 words.
Indexed Addressing is used to selectively move a step from the active recipe to the active step.
If B3:2/5 is energized (one-shot), the words from the active recipe are moved into locations for
use in the active step. The first word selected moves to N7:30. The second word moves to
N7:31. The third moves to N7:32 and the fourth to N7:33.
As the batch program moves through steps of the recipe, the indexing pointer moves starting at
N7:10 and moves through the recipe.
MOV instructions are used for moving smaller amounts of data selectively using indexed or
indirect addressing. Single word MOV statements are used to select individual word groups.
Indexing will be discussed later. For the SLC processors, the index is stored in location S:24.
For Siemens and A-B Compact/Control Logix processors, the index is a word used in the move
instruction. Matrices replace fixed locations for both Logix and Siemens processors.
The following shows words being moved to an active storage area from the steps in a recipe as
the program moves through the steps. First the words of step are moved to the active area. This
is also referred to as the work area or the register area. Next step two data is moved, then step
three, etc. As each step is moved into the active area, a sequence of programming statements is
executed allowing the program to execute the entire step and then move on. The sequence of the
program can easily be displayed in a state diagram. The state diagram may have many parts or
be very simple. The state diagram may be as simple as found in Fig. 13-3 or more
Step 3
Step 4
Step 5
Active Step
Step 3
Step 4
Step 5
Active Step
Step 3
Step 4
Step 5
Execution at the step level is accomplished with a state diagram program. Movement through a
recipe is accomplished with a set sequence of options that must be addressed for each step.
After a step is executed, data is collected about what actually happened. If a scale is used, the
target weight is usually not the actual weight of the step. If the operator has an option to choose
an action, the results of the choice are likewise remembered by the collected data. This data
forms a step in the Recipe Report for a recipe. The word count may be equal to, more than or
less than the active step recipe information.
Active Recipe
Step Report
Word 1 Header
Word 2 Time Step
Word 3 Step 1 W1
Word 4 Step 1 W2
Step 1 W3
Step 1 W4
Step 1 W5
Step 1 W6
A more ordered approach would be to allow the A-B database handler RSSQL handle the data
from recipes. When requested, RSSQL would hand a recipe to the active recipe residing in
storage in the PLC. After an active step is executed, RSSQL hands the data back to a second
RSSQL RSSQL
Database Active Active Database
Recipes Recipe Step Report
Recipe 1 Step 1 Word 1 Time Step
Recipe 2 Step 2 Word 2 Step 1 W1
Recipe 3 Step 3 Word 3 Step 1 W2
Recipe 4 Step 4 Word 4 Step 1 W3
Recipe 5 Step 5 Step 1 W4
Recipe 6 Step 6 Step 1 W5
Recipe 7 Step 7 Step 1 W6
Recipe 8 Step 8
Recipe 9 Step 9 etc
Recipe 10 Step 10
Recipe 11 Step 11
Recipe 12 Step 12
Recipe 13 Step 13
Recipe 14 Step 14
Recipe 15 Step 15
Recipe 16 Step 16
Recipe 17
Recipe 18
Recipe 19
Recipe 20
Next, we will look at the instructions for moving small and large packets of data in the PLC.
The Siemens instruction set will be discussed first with emphasis on moving data based on an
indexer. Then the A-B commands will be discussed based on the RSLogix 5000 instruction set.
A discussion will follow that shows the older SLC and PLC-5 instructions used for moving data.
These older methods were used in the above examples. The pointer in these examples is the
number found in S:24. As this number is manipulated, the pointer is moved down the table. The
S:24 value is referred to as the indexer. The rules for indexing with this method are referred to as
indexed addressing. The method was discontinued with the RSLogix 5000 instruction set. Now,
the indexing is accomplished with a matrix and the index is the number in the matrix [ ]
location. Matrices are also used by Siemens. With each method, the index value must be
controlled or the program will have problems and probably cause the processor to fault. A
pointer out of range is one of the first problems to look for with batching programs if the
processor faults.
Creating arrays in Siemens and Allen-Bradley is not complex. For Siemens, follow the
following two figures to create an array. Note that arrays are not available in the M Table.
To create arrays in Siemens PLCs, use the Data Block type for creating a storage array. First,
choose the "Add new block" command and select Global DB. You will then be able to give
information that defines the array desired. Length and data types are necessary. For most
applications, the data type is INT or DINT. You may choose to have multiple arrays for multiple
data types associated with a list of variables. You may also designate a UDT for this purpose.
The array created in the example above shows an array Array with 51 integer values.
The array length is determined in the boxes below. Multiple array dimensions may be chosen as
well.
The Move instructions have been redesigned from earlier versions and the FieldRead and
FieldWrite instructions are now listed as legacy instructions (not to be used in future).
The following array move is used for the array to working word discussed above:
Examples of the types of addressing available in the ControLogix processor will demonstrate
addressing used in the newer A-B processors. In the following, rung 2 turning on a coil out1 is
not as simple as it first may appear. A table table1 is entered in the database seen below. The
table consists of 320 bits. Two separate pointers determine the status of a particular bit. Index1
may vary from 0 to 9 determining the word in the table to view. Index2 may vary between 0 and
31. The value of index2 determines the bit in the word being viewed.
table1[0]
table1[1]
table1[2]
table1[3]
table1[4]
table1[5]
table1[6]
table1[7]
table1[8]
table1[9]
table1[0]
table1[1]
table1[2]
table1[3]
table1[4]
table1[5]
table1[6]
table1[7]
table1[8]
table1[9]
For instance, if index1 = 1 and index2 = 1, the instruction would add 1 to table1[1]. If index1 = 3
and index2 = 4, the contents of table1[4] would be updated with the contents of table1[3] + 1.
For-Next Loops are not traditionally included in ladder logic for the reason that a scan can
appreciably be lengthened if any loop is executed. For-Next Loops provide a looping control
mechanism that is very useful but is capable of lengthening the loop execution time. They have
been included in the PLC-5 but not in the SLC ladder instruction set. They are also included in
the RSLogix 5000 programming software for both the Control Logix processors as well as the
Compact Logix processors. Excluded from the Control Logix and Compact Logix processors,
however, are the two addressing modes: indexed and indirect.
The For-Next loop requires an indexer that increments each pass the program makes through a
subroutine. The subroutine becomes the program used to execute the logic of the For-Next
operation.
In the above example, the routine MainRoutine executes. Each scan that tag_1 energizes, the FOR
loop Sub_z executes. The program Sub_z executes 10 times with the value of int_point
incremented by 1 from 0 to 9.
Of course, Sub_z allowed to call a subroutine as well with the effect of providing a loop within a
loop. The looping procedure is used for table manipulation similar to the MOV and COP
commands described in this chapter. If the FOR command is not available, a method using a
variable number of scans to execute a subroutine may be employed.
UDT’s
Both A-B and Siemens use UDTs for defining variable arrays of data.
A user-defined structure can contain any base data type (e.g., SINT, INT, DINT, BOOL, REAL)
or structure (either predefined or user-defined). In addition, a single-dimensional array can be
included as a structure member.
To create a user-defined structure, right click on the User-Defined folder in the Controller
Organizer, and choose New Data Type. The Data Type editor will appear, from which you can
define your new data type.
Many control programs require the ability to store blocks of information in tables that can be
traversed at runtime. RSLogix 5000 supports this requirement by providing the ability to create
custom arrays with up to three separate dimensions (i.e., row, column, and depth). Individual
cells within an array may contain any base data type (e.g., SINT, INT, DINT, BOOL, REAL) or
structure (either predefined or user-defined).
The example of a UDT is from the database example of a field. The field defines a set of data of
different data types and allows entry into a table using these data types. UDTs are the same. An
example of a database table ‘employees’ is as follows:
Circular Table
One of the file types studied in a programming course that may be useful in the Recipe Report
portion of the program is the circular table structure. The last step executed is presented in an
area with its time stamp and the computer is assumed to pick up the actual step information and
record it. If multiple steps are available for the polling computer, then the circular file structure
becomes more important. For instance, the last few steps of information are kept in the file. The
PLC program continues to increment through the steps working its way down the recipe and
sending the actual step information to the circular table. When the end of the circular table is
reached, the PLC starts again at the top of the table. This approach allows steps to be read
multiple times by the computer. If the polling computer fails to read a record, the table will
continue to fill till the end of the table is reached. Only when the table is full and wraps over old
data will data be lost if the polling computer is still unable to read the data.
Time Stamp
Step 1 W1
Step 1 W2
Step 1 W3
Step 1 W4
Step 1 W5
Step 1 W6
Time Stamp
Step 2 W1
Step 2 W2
Step 2 W3
Step 2 W4
Step 2 W5
Step 2 W6
Time Stamp
Step 3 W1
Step 3 W2
Step 3 W3
Step 3 W4
Step 3 W5
Step 3 W6
Indirect Addressing for SLC and PLC/5 PLCs (Older Addressing Schemes)
This addressing format allows a storage location to specify the number in the file of the file,
element, or bit in the direct logical address. Up to two address numbers in the direct address are
allowed with indirect addresses.
For example: #F[N7:4]:0 identifies a floating point file whose number is found in the
N7:4location. If this location contains 99, the 99th file would be accessed as element 0. This
would be equal to F99:0.
4 The element number must be within the file’s length. A fault will occur if not.
5 When used to store file number, the file number must represent the same type as the
prefix.
Examples:
Example:
The following contact in a program would have various values depending on the value in
N7:0.
B3/[N7:0]
Example:
The example makes the counter variables being added selectable from any of the counters in C5.
Note that addresses are not limited to whole word addresses. Bit addresses may be referenced as
well.
The rung references B3/ and then a bit in the B3 table referenced from 0 using N7:10 as that
reference. For example, if N7:10 contained the number 30, the bit reference would be B3/30 or
B3:1/14.
It is hard to debug or troubleshoot if you are not the initial programmer. So, don’t use it
unless you find no alternative means to program the task at hand.
It is believed that the use of this addressing method to obscure the logic behind the program led
the designers to discontinue it with the RSLogix 5000 language. Both the indirect and indexed
methods were discontinued with the newer languages.
If one becomes fluent with all the new languages, the procedural STL language may be the best
to be used for indexing program development. Although we predominantly use LAD here, the
Ch. 13 Indexing – Batching Applications 18
STL language has many benefits and should be considered when planning a program with
indexing in mind.
Indexed addressing allows an offset of an address by a number of words stored in location S:24.
To identify indexed addressing, place the # symbol immediately before the file-type identifier in
the address:
For example: #N7:0 refers to word 0 of the N7 file offset by the number stored in S:24.
Use care to insure that the index value (positive or negative) does not exceed file bounds.
With instructions using two or more indexed addresses in the same instruction, the offset
will be the same for all addresses.
Use care to reset the offset to its desired value before enabling an instruction having
indexed addresses.
Example:
N7:10 N7:50
N7:11 N7:51
N7:12 N7:52
N7:13 N7:53
N7:14 N7:54
N7:15 N7:55
N7:16 N7:56
N7:17 N7:57
Using the MOV instruction as a reference, observe that the table of results uses the offset value
found in S:24 to compute a new address for the MOV instruction. The example above moves the
value in N7:14 to N7:54 when the offset in S:24 = 4. Only one word is moved when the rung is
executed. Other program statements should be added to the rung to increment or decrement S:24
to move other locations.
Another example using one offset address and one fixed address:
This is commonly referred to as a Table to Fixed move. This type of rung is used to get a value
sequentially or randomly from a table. It is used in programming recipe routines.
An example using a fixed first address and an indexed second address is included. It is used to
get a value from a fixed location into a table. It is used many times to save the status of an event
that happened in sequence. Picture a line of cars with numeric only license plates. The output
table would save the sequential status these numbers starting with N7:50 and sequentially store
the license plates in order as they passed by a point.
N7:0 N7:50
N7:51
N7:52
N7:53
N7:54
N7:55
N7:56
N7:57
N7:58
N7:59
Using the SLC processor to execute a For-Next loop employs a technique that allows a variable
number of scans to access the subroutine code. For instance, the following code could
accomplish the same function as that shown above if timing constraints were considered.
The program called in U:3 may be used to respond in a manner similar to the For-Next program
if the output of the code can wait the number of scans needed to loop through the entire range of
numbers in int_point. Care must be taken to initialize N7:10 to 0 prior to execution of the code
as well. When the final path through the loop is executed a bit usually is set to signal any user
program that data from the loop is available. This is more cumbersome than the program of the
Compact Logix processor. It also does not easily support loops within loops. Extreme care
must be taken when using this program technique. It is important to note that this type of
program control is used by many programmers and the student should be aware of its
implementation in existing automation programming.
As advances are made from the PLC/5 to SLC to RSLogix 5000 processors, addressing
requirements have been enhanced as well. The RSLogix 5000 processors use indexed arrays to
provide functional equivalent programming to the indexed and indirect methods of the PLC/5
and SLC processors. Modes may be mixed, causing a number of programming types which may
or may not be substituted with the indexed array of RSLogix5000. The following list of
comparisons shows some of the evolution from the PLC/5 to SLC to RSLogix5000 addressing.
Indexed: #N7:0
While PLC/5 and SLC processors use various combinations of Indexed and Indirect pointers to
move data, the RSLogix5000 processors use indexed arrays to accomplish the same task.
FOR-NEXT looping is not used in the SLC processor family but is supported by the PLC/5
family. Use of multiple scans is necessary to provide the equivalent functionality to FOR-NEXT
looping when using the SLC processors.
N7:10 N7:50
N7:11 N7:51
N7:12 N7:52
N7:13 N7:53
N7:14 N7:54
N7:15 N7:55
N7:16 N7:56
N7:17 N7:57
MOVE_BLK Tag_Out
EN ENO
1 COUNT
COP
Copy File
Source IN_Array(index1)
Dest Out_Array(index2)
#IN_Array(index) Length 1
Notice that both the Siemens and A-B newer move statements allow more than one element to be
moved. Also notice that index values for the two arrays may be the same or different.
Ch. 13 Indexing – Batching Applications 25
The Table to Register Move
Another example using one offset address and one fixed address:
Fig. 13-19
This is commonly referred to as a Table to Fixed move. This type of rung is used to get a value
sequentially or randomly from a table. It is used in programming recipe routines.
N7:5 N7:30
N7:6
N7:7
N7:8
N7:9
N7:10
N7:11
N7:12
N7:13
Siemens’ Move equivalent of the indexed address move above: (obsoleted and MOV block used
now)
FieldRead Tag_Out
EN ENO
#IN_Array(index) VALUE
MOV
MOV
Source IN_Array(index)
Dest Fixed_Value
An example using a fixed first address and an indexed second address is included. It is used to
get a value from a fixed location into a table
Fig. 13-20
N7:0 N7:50
N7:51
N7:52
N7:53
N7:54
N7:55
N7:56
N7:57
N7:58
N7:59
FieldWrite Tag_Out
#Fixed_Value VALUE
MOV
MOV
Source Fixed_Value
Dest OUT_Array(index)
Scale Weighing
Scale Weighing Systems are an important part of a batch system. Siemens provides a load cell
interface system for weighing applications called the SIWAREX WP231. It is pictured in the
picture in Fig. below.
Fig. 13-22
The electronic weighing system has the following characteristics as listed by Siemens:
“
Ch. 13 Indexing – Batching Applications 28
● Uniform design technology and consistent communication in SIMATIC S7-1200
● Parameter assignment by means of HMI panel or PC
● Uniform configuration option in the SIMATIC TIA Portal
● Measuring of weight with a resolution of up to 4 million divisions
● High accuracy, 3000 d, legal for trade according to OIML R76
● Legal-for-trade display with SIMATIC operator panel or PC
● High measuring rate of 100/120 Hz (effective interference frequency suppression)
● Limit monitoring
● Flexible adaptation to varying requirements
● Easy calibration of the scales using the SIWATOOL program
● Automatic calibration is possible without the need for calibration weights
● Module replacement is possible without recalibrating the scales
● Use in Ex Zone 2 / ATEX approval
● Intrinsically safe load cell supply for Ex Zone 1 (SIWAREX IS option)
● Diagnostics functions”
SIWATOOL overview
SIWATOOL does not only offer support when you set the scale but also when you analyze
the diagnostic buffer that can be saved after being read out of the module together with the
parameters. The display of the current scale status can be configured.
Fig. 13-23
Fig. 13-25
Load Load
Cell Cell
Load Load
Cell Cell
Load Load
Cell Cell
Fig. 13-26
Fig. 13-27
The following weigh vessels show the location of load cells with the vessel suspended in space.
These weigh vessels show the traditional locating of load cells at four corners of the tank.
Fig. 13-28
The Siemens system is described in the manual: Weighing systems Electronic weighing system
SIWAREX WP231.
Ch. 13 Indexing – Batching Applications 32
Also, the load cell can be terminated in a converter box similar to the Red Lion Strain/Load Cell
Panel Meter pictured below. Since it can be used to interface to a PLC using an optional analog
output, the Red Lion is used simply to pass through a signal from the scale to the PLC after
linearization has occurred with the scale signal.
Fig. 13-29
From the ISA website, the following gives an insight into considerations for the batching
application:
“The ISA88 committee has published a series of standards on batch control in industrial
automation systems.”
They are:
This standard “provides standard models and terminology for defining the control requirements
for batch manufacturing plants”
ANSI/ISA-88.00.02-2001, Batch Control Part 2: Data Structures and Guidelines for Language
This standard “defines data models that describe batch control as applied in industrial automation
systems, data structures for facilitating communications within and between batch control
implementations, and language guidelines for representing recipes”
ANSI/ISA-88.00.03-2003, Batch Control Part 3: General and Site Recipe Models and
Representation
This standard “defines a model for general and site recipes; the activities that describe the use of
general and site recipes within a company and across companies; a representation of general and
site recipes; and a data model of general and site recipes”
This standard “provides a detailed definition for batch production records, establishing a
reference model for developing applications for the storage and/or exchange of batch production
records. Implementations based upon the standard will allow retrieval, analysis, and reporting of
selected batch production record data”
The purpose of the SP88-ISA-88 specification is to provide a common strategy for all batch
applications programmed. These include PLC programs. To be included are the physical and
functional implementations. The functional model includes “the relationships between the five
types of control recipe management, scheduling, sequential control, regulatory control, and
safety interlock systems.”
Examples are the definitions for modes, states and alarms for a typical batch system. They are
Ch. 13 Indexing – Batching Applications 34
defined in the specification as:
Auto
SemiAuto
Manual
Bypassed
Controlled
Reset
AlarmPresent
AlarmAcknowledged
As discussed previously, the reporting function is important in that values are required by the
higher level computer. Such values as actual weights by the scale, errors, status of the batch
should be saved and reported for each step of the batch.
While the chemical engineer or mechanical engineer is usually in charge of determining the
equipment design and feeds for the process, the electrical engineer/program designer is
responsible for programming the process. Thus there is a concern and desire to have input in the
process from the beginning. The PLC program should be knowledgeable of the feed rates, the
ingredients to fill, the coordination of when and how to mix and dump the material, when to
apply heat, etc.
With the batching system, scales and other material feed devices are required to monitor and
control the feed rates of the various materials. SP-88 defines the following material feed types:
FILLING
“The SINGLE transfer (movement) of a specified amount of product from one single
location to another location”
DOSING
“The SINGLE transfer (movement) of a specified amount of product from one location
into a continuous process”
FORMULATION
“MULTIPLE transfers (movements) of specified amounts of products from various
locations into a single location”
BLENDING
“MULTIPLE transfers (movements) of specified amounts of products from various
locations into a single location plus a single ADDITIONAL process phase – mixing”
BATCHING
To add material using any of the above methods, a scale or load cell system should probably be
used to accurately weigh the product being added. The scale can be either on the container being
added to or fed from. The steps in weighing are critical in that consistency needs to be
maintained and proper records kept of all transactions. Decisions need to be made as well
whether the weight added is acceptable or not. The SP-88 document divides the weighing cycle
into six states as follows:
Pre Feed
Feed Start
Feed
Feed Stop
Feed Finish
Post Feed
It may be important to the programmer to identify every step and build their program around these
steps. Certainly the steps add order to the program and aid in troubleshooting the system. The
state diagram shown below also helps in identifying areas of concern and giving aid in
programming the feed
A state diagram is included in the SP88 diagram for each step of adding material and used as a
review of the steps outlined above:
Reset
Alarm In Alarm
Complete
Reset
Pausing
Abort
Resume
Paused
Aborting
Reset Abort
Aborted
Fig 13-30
Alarms are likewise included the presence of an alarm, the setpoint over or under-run of the add
and whether or not the actual weight was acceptable to the operation before proceeding.
REPORTS
ActualFeedWeight
Error
ExistStatus
Some of the terms used in the addition of material using scales or rate feeders include:
Weighing Terminology
Gross
Net
Units
Zero
Center of Zero
Under Zero
Control Methods
BASIC Control – single speed transfer control
Flow Rate
Tolerance
Jog (re-dispensing)
Manual Jog – operator starts jog feed and operator ends jog feed
Semi-Automatic Jog – operator acks out of tol, starts jog feed and
controller ends jog feed
Automatic Jog – operator acks selects auto accept out tol, controller starts
jog feed and ends jog feed
Setpoint Error, Target Error, Feed Error”
The inclusion of this kind of information regarding the addition of a material to a batch may
seem too much to digest but when faced with the task of programming the entire batch system,
many times from no prior program, it is important to ask the right questions and be able to make
the system perform to specification. Many people are depending on the accuracy of the batching
system since the product being made must guarantee accuracy within specifications on the label
of the product in the store. For pancake mix, this is very important, especially for those of us
who like good pancakes.
Now that we have somewhat of an idea about a batching system structure, we could picture the
instructions used by the various PLC’s to provide the step move to an active step. The steps are
activated sequentially starting with step 1, step 2, …
Active Step
Step 1 Active
Step 1 Step Word 1
Step Word 2
Step Word 3
Step 2 Step Word 4
Step 3
Step 4
Step 5
Active Step
Step 3
Step 4
Fig. 13-31
Step 5
The following picture is of a liquid batching system capable of simultaneously mixing batches in
three main mix tanks. In addition, there are six pre-mix tanks – any of which can be mixing a
pre-mix for any one of the main mix batches. Each tank measures addition of weight via scales.
Multiple pre-mixes may be required for each main mix and they mix concurrently in various pre-
mix tanks. They then add to the main mix at a prescribed time.
Begin to plan the programming of how a recipe is to be constructed to handle such a system as
this.
There are other recipe types not necessarily using scales and mx tanks. The following two
examples give some insight into the diversity of types of recipes.
Valve Nest:
This example requires a number of paths through a number of valves in a valve nest. Each valve
has two limit switches, one closed with a closed valve and one closed with an open valve. Each
valve in the transfer path must be set appropriately and its limit switches closed or opened in a
recipe in order to allow a transfer to occur. With a number of different transfer paths, these paths
may be considered recipes.
The heating of steel in the hardening process requires a recipe of time and heat setpoint. The
hardness of a piece of steel is determined with a recipe.
Several pieces can be inserted in the oven at the same time if they all support the same setpoints
and soak times. If various types are to be introduced at the same time, then a check must be
performed to determine whether the different recipes can be used at the same time.
This is similar to baking a cake. If one is determined to use the oven to bake a large number of
cakes, if one cake is ready to take out, then another cake can be inserted in the oven even if there
is a longer baking cake still in the oven.
The rules in the steel example are used to determine whether multiple pieces can be inserted at
the same time. These rules can be intricate.
This chapter explains a number of data handling instructions and provides applications for their
use in factory automation. Instructions are provided for a number of operations that would
otherwise have required a significant programming effort to provide. Included are the queuing
operations using FIFO instructions. Other interesting instructions in data handling include the
bit-shift instructions. These instructions are used for shift register part tracking. Instructions
used in data manipulation were shown with examples included for each type of instruction. An
example of a batching application demonstrated the handling of large amounts of data. The
chapter concluded with a discussion of For-Next loops and their inclusion in possible data-
handling operations.
Included at the end of the chapter are two important labs using file manipulation to control
simple games. The games Simon Says and Whack-a-Mole are used to provide an experience in
the use of table-to-working register functions. In the MicroLogix 1000 processor, the only
available mode to consider table-to-register moves is the indexed mode. Whether using the
MicroLogix 1000 or other processor, these labs provide valuable experience programming
simple batching applications such as these. The example program was written for the
MicroLogix 1000 processor.
You may be curious how two games, Simon Says and Whack-a-Mole have anything to do with
batch applications. If run as sequences of numbers, the same operations used in these games are
used for batch applications. The games are to be programmed in this way. They are not to be
programmed using random number generation but rather as storage of information in tables and
then retrieving the information as the game is being played. The Whack-a-Mole game has the
added similarity to a batching program in that one of the options asks for a report back as to how
soon after the mole popped up that the button was pushed. This is similar to the report of actual
weight added for the batch report. Hopefully these labs will give some insight into actual batch
programs.
Use four illuminated push buttons to build the game Simon Says.
Use a fifth button to start the game.
Use a sixth light to signal the game is done good.
Use a seventh light to signal the game is done bad.
Simon Says is a sequential game that plays a four-note tune. This lab has no sound so lights will
have to do. After the start button is pushed, one light at a time is turned on. The player must
mimic or push the button attached to the light. First one light is lit, then two, then three, etc.,
until a final number is attained. Assume 15 is the final number of steps in the game. The steps
are repeated each time the game is played. The values are to be stored in a table and re-used.
Lab 13.1A Add a three-position switch to allow for easy, middle, hard ranges varying the
number of steps from 10 to 15 to 20.
Lab 13.1B Automatically rotate through 3 different sets of conditions for each range – easy,
middle, and hard.
Lab 13.1C Vary the speed that the lights are display as the player gets closer to the last step.
Lab 13.1D Create a teach mode using a separate button to teach the game a sequence of
steps.
Use the program starting on the next page as a suggested beginning point for your logic:
The program below is programmed for three, not four buttons and is programmed using
indexed addressing from the SLC architecture PLCs from A-B.
The file must also be inserted for the game to work correctly. Set the Radix to Binary and set
each word from N7:0 to N7: with either a 1 in the bit 0, 1, 2 or 3 position. The game will be
played using these entries.
Design a Whack-a-Mole game using only 4 lights. The game is to react to the light by pushing
that particular button before the light turns off. Construct the game so that the time between
lights is pseudo-random (you pick various numbers) and the next light to turn on is pseudo-
random (again, you pick). Count the steps (light turn-ons) and stop at 30. If the person playing
the game is successful 10 of the 30 times, blink all the lights a number of times. The steps are
repeated each time the game is played. The values for buttons and time delays are to be stored
in a table and re-used.
Whack-a-mole buttons
Fig. 13-36
Lab 13.2B Create a teach mode using a separate button to teach the game a sequence of steps
which can then be played.
Lab 13.2C Add a table of results including whether the player hit the light while the light was
on and how long the response was delayed from when the light first turned on.
Results for each hit are to be saved sequentially in the table.
1. Write logic to move sequential data from a table starting at N7:20 to location B3:20. Use
B3/9 to reset to the top of the file (B3/9 is a one-shot pulse). Use B3/10 to move the data
(B3/10 is also a one-shot pulse).
Destination Value
2.. MOV N10:0
#N7:0 and s:24 =2 N10:1
N10:0
N10:2
N10:3
N10:4
N10:5
3. MOV
Destination Value
#N7:0 and s:24 =4
#N10:0 N10:0
N10:1
N10:2
N10:3
N10:4
N10:5
5. With the problems 2-4 above, rewrite the logic using Siemens’ LAD equivalent instruction,
Allen-Bradley’s RSLogix 5000 LAD equivalent instruction.
6. Rewrite rungs 9-14 of the Simon Says sample program using A-B RSLogix 5000 LAD code.
7. Review the following from the Chemicals & Petrochemicals Plant Automation Congress
2015 presentation “Batch Process Control Strategy”
9. Discuss implementation strategies for programming the batch project in Fig. 13-32.
Linking PLC UDT Tags to HMI Faceplates and Pop-ups in TIA Portal V13 SP1 (DMC Corp)
A blog posted by Jason Mayes in Front Page, PLC, Automation, Siemens PLC, HMI and
SCADA, WinCC
PLEASE NOTE: This blog was written using features available in TIA Portal V13 SP1
Update 1. Some of the functionality shown was removed in Update 3, specifically the ability
to multiplex UDTs. Hopefully the rest of the information will be still be helpful to you!
Here at DMC, we spend a lot of time programming PLCs and HMIs. While we program systems
of all types and flavors, I'm personally most experienced with Siemens (TIA Portal)
and Rockwell (RSLogix5000/FactoryTalk View). There are a few new features included in TIA
Portal V13 SP1 that I have found to be incredibly useful in the past few months and have allowed
me to be even more efficient in my programming. I'm going to focus today on a series of updates
that were added in SP1 that make it even simpler to take advantage of the nested data structures
we can create in our Data Blocks - specifically, the ability to share UDTs between a PLC and
HMI, link UDTs to Faceplates, multiplex arrays of UDTs, and create simple, powerful pop-ups.
Before we get started, let me say that if you're not already taking advantage of PLC data types
and Global DBs to build rich data structures in your project, you're missing out. Having come
from an object-oriented programming background, I really appreciate what the Function
Block/Data Block paradigm will allow you to do in a PLC - it really does push PLC
programming towards object-oriented programming. And let's face it, the less time we all spend
on repeating tasks and minutiae, the more time we can spend actually programming.
As an exercise, let's pretend we have a project with a large number of simple valves. Of course
we like to save time, so we're going to develop a special FB to handle our valves: auto/manual
control, alarms, etc. In addition to eliminating the amount of code to be written, this allows us
the additional advantage of keeping our future valve logic updates to a single place. Our FB has a
few inputs including the feeback signals for open/close, an in-out for our 'valve' data type, and an
output for the open/close command.
We've broken our data type into three structures: configuration, status, and control. The
configuration group of parameters defines the valve's physical behavior and its unique name. The
status group contains all status information about the valve and is used both within the PLC and
the HMI. The control group has the open/close and fault reset requests. I find breaking things up
like this makes it much easier to find the right tag you're looking for when programming.
For our valve Function Block, fbValve, let's say we have something like this:
The final step on our PLC is to add our newly written code. I've created a FB (fbValves) to
contain all of my valves, instantiated 10 valves (multi-instanced versions of fbValve) within it,
and dropped fBValves into OB1.
Let's start with the first task - our simple P&ID. I'm going to grab a simple valve from the
toolbox (under "Elements - Symbol Library") and add an indicator for the valve name. Under
"Properties - Appearance" for the symbol, I'm going to change the "Fill Style" to "Shaded". This
will allow me to add some color animation to the valve: Orange/flashing when the valve state is
not known, Grey when the valve is closed, and Green when the valve is open. Additionally, I
would like the valve's name to change to Red and flash when the valve is faulted.
I could start adding in my animations now, but I don't want to have to redo that process for each
valve. Instead, I'm going to create a faceplate so I can write the logic once and reuse it several
Ch. 13 Indexing – Batching Applications 57
times. To do this, select both the valve symbol and the valve name indicator, right-click, choose
"Create Faceplate", and name it 'ValveIndicator'.
Inside the faceplate editor, I could create new properties for the fault status, the valve state, and
the valve name, then tie each to the appropriate item/animation. However, this would require
linking each of these properties back to the appropriate tag inside of my data structure. With a lot
of valves, this could take a lot of work. This is where one of the new TIA Portal V13 SP1
updates will come in handy: the ability to use PLC UDTs (PLC data types) in the HMI.
To have access to a PLC data type on the HMI, we will first need to add it to our project library
as a type. To do so, just drag udtValve from the PLC project tree into the "Project Library -
Types" folder:
When you're finished editing your Faceplate, release the version and let's go back to editing our
HMI screen. Select the new Faceplate object and view the Interface tab. Link it back to
dbValves.Valve[0] by navigating to "Program Blocks - dbValves".
That's it! Now we can add more instances of our Faceplate to the screen and simply link a new
valve instance to each - nothing to it!
Ch. 13 Indexing – Batching Applications 59
So, getting back to our original goal - we've succeeded in creating a simple Faceplate that can be
linked directly to a single tag (UDT).
The second task we set out to accomplish was to create a pop-up that can show more detailed
information for any given valve. In this case, we want to create our pop-up so that it is capable of
being opened to display any one valve at a time. To do this, we will need to set up a
'multiplexing' tag to look at different valve instances in our array of udtValve. If you've tried this
before, you may have run into issues. Luckily, there have been a few updates in V13 SP1!
First, let's set up our 'multiplexing' tag. We'll need to create an 'index' tag locally on the HMI that
can be used to choose the active valve. In my default tag table, let's first create a local Index tag
(with type of "UInt"). Next, in your project tree and while still looking at your HMI tag table,
select dbValves. From the "Details View" (see screenshot below), drag Valve[1] over to your
HMI's default tag table and change the name to IndexedValve:
The last piece of our puzzle is the pop-up. This is another great addition to TIA Portal V13 SP1
(for more info, see this). To create a pop-up, navigate in the project tree under your HMI to
Ch. 13 Indexing – Batching Applications 62
"Screen Management/Pop-up Screens". Add a new pop-up screen and add your new faceplate to
it. Select your faceplate and view the "Interface" tab under Properties. Now, link
your IndexedValve to the faceplate.
Finally - our last step. Add an invisible button and place it over one of the valves on your P&ID
screen. You can do this by using a button from your HMI toolbox and configuring it to be
'Invisible' from within the properties. On the button's Click Event, add the following:
There you have it! We've taken advantage of several really great features that were added in TIA
Portal V13 SP1: the ability to use PLC data types (UDTs) on an HMI, the ability to link a
faceplate to a single UDT, the ability to multiplex an array of UDTs, and the ability to add a
simple pop-up. As I'm sure you can imagine, there are many potential uses for these new features
and this example is just one possible application. Good luck programming and let me know if
there are any new features you've found that can help me be more efficient in the future!
The Controller Organizer has a folder called Data Types > User-Defined with all the UDTs in the
project.
I am of the opinion that every PLC program should rely heavily on UDTs to improve readability,
and if you are OOP adept, it can be a great help to organize your classes.
Classes: Classes define the abstract characteristics and behavior of an object. For
example, a simple VALVE class would have the characteristics (or attributes) that it
can be open or closed (the things it can be), and as far as behavior goes, it could have
the methods to open and to close (the things it can do)
Objects: An object is an instance (occurrence) of a class. In our example, there could be a
Valve_001 and a Valve_002, which are both instances of the class VALVE, with the
same attributes and methods.
If you look at a valve as an object in a typical industrial automation environment, you should
note the following:
A UDT for this class would fit all these properties and methods in one simple type. But, as
always, we can expect further complications of the class VALVE during the realization of a
project. To be as flexible as possible, I highly recommend the practice of nesting UDTs, which
will become clear along the way.
Lets start with defining our class, and keep in mind that it will have to be easily accessible for
maintenance people or other programmers.
If we start at the I/O end, the best method is to create sub-classes called VALVE_IN and
VALVE_OUT, which will contain our I/O.
The following example uses RSLogix5000 V16. First, create the sub-classes. From the File menu
select New Component > Tag. The following dialog box appears to create and edit the members
of the UDT.
As you see, I am allowed to take the types I just created as the data type in this UDT. The real
advantage of this feature will become clear if you create an object called Valve001 of the type
VALVE, and look at the object in the monitor tags window:
Of course, going further with this concept, everything for a valve can be included in one object.
Allow me to skip some steps, and show you a possible final result:
The VALVE class is now contained in a UDT called VALVE, which looks like this:
While adding stuff to my class, I did not have to re-create the object Valve001. RSLogix updated
it for me, so all the properties and methods are available in my program.
Now, let’s say you’re working on this project with a couple hundred valves, and the customer
decides to go with a different type of valve, that also has an analog input, that tells us the exact
position of the valve. All we have to do is modify our VALVE_IN sub-class to add this to every
instance of the type VALVE:
For somebody that is not familiar with your program, it might be confusing to look at all your
UDTs. We just made eight UDTs for one simple valve class! But remember, you only have to do
this during the design phase. Once you have a solid design for all your classes (and made sure
their names are self-explanatory), you will never have to look at your UDT folder again, and
creating a new instance will be a breeze.
Posted by Gina Brooks-Zak in PLC, Automation, Siemens PLC, HMI and SCADA
With Siemens TIA Portal V14, a great new tool for PLC and HMI development
called MultiUser Engineering was released.
MultiUser Engineering allows multiple developers to access a server project through local
sessions and quickly and seamlessly merge updates to PLC or HMI code such as function blocks,
user-defined types (UDTs), WinCC Comfort or Advanced screens, and more.
DMC has been using the MultiUser tools with great success, and I'd like to share a few insights
with you here.
For machine builders or large facilities with many TIA Portal projects, it makes sense to create a
secured LAN and/or VPN accessible file location for your developers. DMC has set up
something similar, but we've also used the MultiUser server in a static IP LAN environment for
short commissioning jobs where there is too much overhead to hook up to a wider network.
One commissioning engineer can easily set their laptop to host the server and other
commissioning team engineers can then access the files by inputting the static IP address of the
host laptop. This is a great time saver when hardware configuration or other fundamental project
changes common at commissioning time would require all engineers to get a new copy of the
project once the updates were downloaded to the PLC.
If you do use this strategy, make sure you always consider network security and use
caution, especially if there are any connections to an outside network.
A local session contains the individual changes of a developer. With local sessions, the following
can occur:
Each function block or HMI screen can be flagged by the developer to indicate to
everyone else who has a local session open that they are working on that block.
When the developer is complete with changes, they can be "checked in" to the server
project. The other developers can then push those changes to their local sessions
by refreshing from the server project.
If there is any question of who may be working on a certain flagged block, users can right-
click on the flagged item and select Usage Info to see the user’s local session and name.
When working online with a PLC using MultiUser Engineering, remember that the server
project is not necessarily consistent with the code that is on the PLC. Code changes still need
Ch. 13 Indexing – Batching Applications 74
to be downloaded to the PLC. One developer’s changes do not automatically appear on another
developer’s software instance.
That being said, there are many instances where this functionality is advantageous; it allows
greater control of the timing of changes and when test code is set to be downloaded to the PLC.
An engineer may want to test code online with a PLC before checking in to the server copy while
another engineer tests their local session on a completely different PLC.
I have found that in a commissioning environment where you are working on one PLC, it is best
to keep the server project the “consistent” online copy of the PLC. When one user checks-in,
it is their responsibility to refresh their local session and then download the changes to the PLC.
Remember that the server project copy, local session, and the project online with the PLC may
all have different code or pending changes
It's important to note that when you or another user is editing the server view, a yellow icon with
a lock symbol displays in the local instance toolbar and no other users can check in their
changes until the server view is closed through clicking Save Changes, Discard Changes or
the server symbol in the local instance toolbar.
Warning dialogue when attempting change in local session which must be made in the server
project
When opening a project in server view, make sure to navigate to the change you were trying to
make. You’ll see both the local session and the server view in your left-hand Portal Project Tree.
Users can not check-in while the server project is being edited. Users see a yellow icon with a
lock in this case.
If you are managing the server project file location, make sure to increase the number of stored
project versions through the MultiUser Configuration application (the default is 3).
If a mistake is made on a check-in, the server project version can be rolled back using the
MultiUser Administration application. In addition, I’ve seen a few times where the server project
gets locked, and I’ve had to go into the Administration application to unlock or delete a local
session.
This tool is very useful for managing all your projects. You will also want to occasionally export
and archive a local session consistent with the server project for an extra layer of backup since