You are on page 1of 25

# Introduction to PLCs

## Industrial Control Systems

Introduction to PLCs

This is the first part of the Industrial Controls course. In this part we will discuss
the architecture and use of Prtogrammable Logic Controllers (PLCs).
Allen Bradley has donated several PLC-5 and SLC-500 systems to the University of
Akron. Allen Bradley is a very popular architecture and widely used in industry.
For these two reasons we will center all of the lectures and laboratories around the
Allen Bradley architecture and instruction set.

Overview

Boolean Logic
Logic in C
Meaning of Programmable
Alternate Forms used by PLC
History
Modern PLC

Introduction to PLCs

## As electrical engineering or computer engineering students you have had exposure

to programmable logic in Switching and Logic and in Programming for Engineers
or Introduction to Computer Science. We will discuss both of these approach in
today's lecture.
For field programming with industrial strength interfaces the PLC is unrivaled. We
will discuss why this is so in today's lecture.
A historical perspective helps in understanding why the PLC have their architecture
and instruction set.
A quick look at the systems to be used in this course will make that first laboratory
exercise a little more relaxing.

Example
There are two pumps referred to as pump1 and pump2 in a control
system. Between the two pumps is a tank. The tank has a
normally closed float switch at the top of the tank called below1.
The tank has a normally open switch at the bottom of the tank
called below2.
Control the level in the tank so that is remains between the
bottom and the top by controlling the two pumps

Introduction to PLCs

## Consider the example below as a starting point to investigate different styles of

programmable logic.
There are two pumps referred to as pump1 and pump2 in a control
system. Between the two pumps is a tank. The tank has
a normally closed float
switch at the top of the tank called
below1. The tank has a normally open
switch at the bottom of
the tank called below2.
Control the level in the tank so that is remains between the bottom
and the top by controlling the two pumps
This problem is referred to as the twin-pump problem or twin-pump example.

Boolean Logic

## One way to represent control logic is

via Boolean logic or equations.

was = between
between = below1 AND NOT below2
turn1 = ( NOT turn1 AND was AND NOT between ) OR
( turn1 AND ( NOT was OR ( was AND between) ) )
pump1 = NOT was OR ( between AND turn1 )
pump2 = NOT was OR ( between AND NOT turn1 )

Introduction to PLCs

One why to represent the logic that solves the twin-pump problem is in the form of
Boolean equations. These equations can then be used to construct a dedicated
circuit in discreet gates, programmable logic device (PEEL), or a VLSI circuit.
This logic can be translated to configuration files using WinPLACE or VHDL if this
device is to be implement in a programmable logic device such as a PEEL or a Field
programmable Gate Array.
There is a history implied in this set of statements. After the second statement is
executed, was is the previous value of between and between is the present value. In
a hardware device this would be accomplished using some form of memory element
such as a flip flop. In a PLC this would be accomplished with an internal contact
and internal coil. The coil would only change after each scan of the logic is

Meaning of Programmable

## the logic can be readily altered,

the size of the logic subsystem can vary,
the size of the logic component can be
large, and is not subject to "hard" limits,
the logic can be defined in the field, in a
way appropriate to the user of the
embedded system.

Introduction to PLCs

## The P in PLC stands for programmable. What does this imply?

The logic can be readily altered. In a PLD using WinPLACE or VHDL we can
equations. The software then produces a configuration file which changes how the
outputs are changed relative to the inputs. In a PLC the programming is
accomplished via a set of data structures and how they are interpreted.
The size of the logic subsystem can change. With PLDs the complexity of the
equations can be increased. This may lead to a higher percentage of the system
resources being used. When the utilization exceeds 100%, a larger device must be
used. In a PLC when the utilization exceeds the existing capacity, the data
structures must be repartitioned. If this still does now provided enough space more
memory is added to the system. Often by purchasing a larger more costly module.
The size of the component in theory is not subject to a hard limit. The practicality
of the matter is that cost may force a hard limit.
The device must be programmable by the end user in the field. In a PLD this is
done in a programmer or insuti. In a PLC the program is downloaded from a
computer via a serial cable or over the internet.

C Language

## Another way to represent programmable

logic is in a high level language
readfloats( int *bw1, *bw2 ) {
. . . . . .
}
main() {
int below1, below2, between, was, turn1,
pump1, pump2;
while (1) {
was = between
between = below1 && ! below2;
turn1 = ( ! turn1 && was && ! between ) ||
( turn1 && ( ! was || ( was &&
between) ) );
pump1 = ! was || ( between && turn1 );
pump2 = ! was || ( between && ! turn1 );
}
}
Introduction to PLCs

## The twin-pump problem could also be solved using a C program on an embedded

microcomputer. The example on the above slide solves the problem. Notice that
history is again used. This is accomplished by the fact that statements are executes
in sequence.
With C, a function must be used to read the inputs and write the outputs at two
different locations in the code. With the PLD, the inputs are always present on the
input pins. The equations are evaluated concurrently and then update the outputs.
The inputs and outputs are often held in a stable condition by flip-flops.
With a PLC all of the inputs are read and placed in a table. The logic is evaluated
and the output of each equation is written to an output table. After all the logic has
been evaluated, the end of the ladder, the output table is written to the output
modules. This read, evaluate, write sequence then allows the PLC to mimic the
PLD and the C program.

Logic In C

## C supports both bitwise and logical

Boolean operators.
Bitwise

Operation

Logical

&
|
~
^

AND
OR
NOT
XOR

&&
||
!
None

Introduction to PLCs

## C and hardware description languages allow the equations to be expressed as either

bitwise operators or logical operators.
PLCs allow the same thing and they can be expressed in:
Sequential Function Charts
Structured Text
We will discuss these three language or representation in lectures latter on in the
course.

Alternate Forms

Sequential Function
Charts
Special PLC Language
such
as Structured
Text

Introduction to PLCs

Graphical representations of these alternate forms are shown in the above slide. The
meaning of these forms will be discussed latter on in the course. We will also
concern ourselves with how to enter these forms using the software tool RSLogix.

languages

## Structured Text (supported by AB)

Function Block Diagram
Instruction List Programming
Sequential Function Charts (supported by
AB)
Introduction to PLCs

At one time each vendor of PLCs would develop their own set of languages that
could be used to program the device. To allow some uniformity between platforms
the International Electrotechnical Commission (IEC) developed and published the
IEC 1131-3 standard. Most PLCs adhere to this standard in that they support one or
more of the representations. As an example Allen Bradley supports three out of the
five languages. We will learn a little about all three of these languages. The
laboratory exercises will use two of the languages (Ladder Diagram and Sequential
Function Charts).

Structured Text
was := between;
between := below1 AND NOT below2;
turn1 := ( NOT turn1 AND was AND NOT between ) OR
( turn1 AND ( NOT was OR ( was AND between)));
pump1 := NOT was OR ( between AND turn1 );
pump2 = NOT was OR ( between AND NOT turn1 );

Introduction to PLCs

10

The above is an example of structured text. Structured text comes the closes to the
PLDs hardware description language and the C language example. This form is the
most natural for students without ladder diagram experience. This is because they
have had experience with PLDs and C language.

10

## Graphical representation of logic

structure in design
structured text inside each step
Step
Transition
Step
Introduction to PLCs

11

The above example is sequential function charts. This form is easy for those that
like flowcharts and Algorithmic State Machine (ASM) charts. You most likely have
had experience with both of these.

11

was

between

below1

below2

turn1

was

turn1

between

between

turn1

was

was

between

Introduction to PLCs

12

Ladder diagrams are the most alien to electrical engineering and computer
engineering students. Because we have yet to use ladder diagrams to represent
programmable logic. But ladder diagrams are the most popular among practicing
engineers for historic reasons. The lectures will present ladder diagrams first and
then structured text and sequential function charts will be discussed.
It is my contention that most of the problems with PLC programs are because of the
limited capabilities of ladder diagrams. I will try to make you a user of the more
advanced languages of structured text and sequential function charts.

12

History

## High Documentation Cost

High Fabrication Cost
High Debugging and Modification Costs

## Solid State Relays (too unreliable)

Programmable Controllers (PC) ->
Programmable Logic Controller (PLC)
Introduction to PLCs

13

Originally all logic was implemented using electromechanical relays. The relays
predate electronics. Once solid state electronics was developed many vendors tried
unsuccessfully to migrate systems from relays to solid state relays. The problem
with solid state relays were:
The technology was unproven
Not enough of the high in the slide above were reduced to low with the
use of solid state relays
The industrial control industry is a mature field that does not except change
without over whelming benefit
Following solid state relays came the PC or programmable controllers.
When IBM introduced the IBM PC the PC term for programmable
controllers was often confused with personal computer. Programmable
Controllers were changed in name only to Programmable Logic Controllers
or PLCs. PLC is just the modern name for PC.

13

Modern PLC

## Power supply (for electronics only)

Processor (embedded controller)
I/O Rack
I/O Modules

## Digital (AC, DC)

Special (PID, BCD, )
Introduction to PLCs

14

The modern PLC has several components in the system. The power supply only
supplies power to the processor and the electronics in the I/O modules. The
external components such as heaters, position sensors, and the like need their own
external supply
The processor module contains the brains or the embedded controller. The
processor contains the logic and the ability to evaluate the logic.
The I/O rack holds the power supply, processor, and I/O modules. The rack is a
chassis with a backplane.
There are a large number of I/O modules available for any given PLC. We will use
several different type in the laboratory exercises. The I/O modules translate the real
world voltages and currents in the voltages and current suitable for the VLSI
processor chips in the processor module

14

I/O Modules
Input

Output
N.O.

Device
N.C.

Introduction to PLCs

15

The power supply for the PLC only supplies power to the electronics. It is the
responsibility of the user to provide power from an external source for the input and
output modules. Lets assume that the input module is for AC power and the output
is for AC power. The normally opern (N.O.) and normally closed (N.C.) switches
would be connected between the HOT bus and the input module node. The input
module would then have a common node connected to the NEUTRAL: bus. If
the input module senses a voltage relative to the neutral that is above a specified
threshold the input is sensed as a logic 1 or is on. Else the input voltage is below
the threshold voltage the input is a logic 0 or is off.
For the AC output module the node acts as an AC switch. If a logic 1 is written to
the node, the switch is closed and hot bus is connected to one side of the device, i.e.
lamp. The other side of the device is connected to the neutral bus. This applied hot
to neutral voltage across the device.
The hot bus could be replaced with a positive DC voltage and the neural with DC
ground, if the modules are DC input and DC output modules. If both AC and DC
modules are used, two external supplies at a minimum are needed.

15

## O or Output Image (File #0)

I or Input Image (File #1)
S2 or Status (File #2)
B3 or Bit Data (16 bits per word) (File #3)
T4 or Timer (File #4)
C5 or Counter (File #5)
R6 or Control (File #6)
Introduction to PLCs

16

The memory in an AB PLC are grouped in to block of memory called files. The
first 8 files (file 0 through file 7) are assigned by default. You will be exposed to
some of these file types in the laboratory exercises. Others you will only read
O is for the outputs
I is for the inputs
S is for the processor status bits
B is for internal inputs and outputs, those not associated with an Input or
Output module
T is for timers
C is for counters
R is for control registers used with some instructions

16

## N7 or Integer (File #7)

F8 or Floating-Point (File #8)
Dn or BCD (None)
An or ASCII (None)
Additional Files (n = #9 to #999)

## Size and number of types limited by

memory size
Introduction to PLCs

17

## N is for numbers of integers

F is for floating point numbers
D is for Binary Coded Decimal numbers
A is for ASCII (American Standard Code for Information Interchange)

The size and number of files is limited by the memory size in the processor.
These may be changed from there default size using programming tools. In
fact the file types may be associated with other file numbers if you so desire.

17

## AB PLC-5 & SLC 500

Program Files

System File 0
System File 1
Program File 2
Program Files 3 to 255

Introduction to PLCs

18

18

## AB PLC-5 & SLC 500

O:rg/00 to 17

r = rack number
g=group number (position in rack)
Node number in octal (PLC-5)
Terminal number in decimal (SLC 500)

I:rg/00 to 17
S:e/b

e element number
b bit number 0 to 15 in decimal
Introduction to PLCs

19

Each node of each input or output module must be numbered or have an address.
For the PLC-5 family the numbers are expressed in octal. For the SLC 500 family
the numbers are expressed in decimal. The rack number is the chassis number. The
group number relates to the modules position in the rack (chassis). The node
number related to the relative position of a terminal within a module.

19

Xf:n

f is file number

## do not need to use default

if default used; then can be omitted

## n element number in file

Introduction to PLCs

20

The address for the other files is of the form Xf:n. X is a letter that is unique to the
file type such as F for floating-point numbers. The f is the file type which is 8 for
floating-point numbers bt default. The n is a unique number starting at 0. Each
n uses a given number of bytes in memory. If n numbers are skipped, that
block of memory is wasted, that is not used.

20

## Micrologix & Pico Controllers

Introduction to PLCs

21

Allen Bradley has several different families of PLC. For small dedicated
application there are the Picologix and Micrologix family of devices. With these
devices the power supply, processor and input output modules are all integrated into
one systems. If you run out of inputs or outputs you must buy another Pico
Controller or Micrologix device. The devices themselves are not expandable.

21

## SLC 500 Chassis

Introduction to PLCs

22

For larger applications, the SLC 500 family can be used. The SLC 500 chassis
allows one to place a processor in the first slot and various input and output modules
in the other slots. You can pick and choose which module goes into which of the
remaining slots. This flexibility comes at the higher cost per node over the
Micrologix of Picologix cost per node.

22

SLC-500 Modules

Introduction to PLCs

23

The above slide shows a typical SLC 500 system with the power supply to the far
left. The processor is to the right of the power supply. Five modules of either the
input type or the output type are to the processors right. There are larger chassis
for the SLC 500 family that allow more modules.

23

PLC-5

Introduction to PLCs

24

The PLC-5 family is older and more mature then the SLC-500 family. It also uses a
power supply, chassis, processor and I/O module architecture.

24

PLC-5 Processors

Introduction to PLCs

25

As the processor number increases several things change in the processor. The
memory size increases. The communication capabilities increase. The processor
speed increases.

25