You are on page 1of 70

Programmable Logic Controllers

• PLC V/S Normal computer.


PROGRAMMABLE
LOGIC CONTROLLERS

Manufacturing Systems
Exercise

What are some common examples of


control?
Washing machine, sump pump,
microwave, ….
Others?
Types of control
• Temporal -- control based in time
• State -- control based in state level
• Hybrid – both temporal and state
PURPOSE OF Programmable
Logic Controllers (PLCs)
• Initially designed to replace relay logic boards
– Sequence device actuation
– Coordinate activities
• Accepts input from a series of switches
• Sends output to devices or relays
FUNCTIONS OF CONTROLLERS

1) on-off control,
2) sequential control,
3) feedback control, and
4) motion control.
CONTROL DEVICES
1) mechanical control - cam, governor, etc.,
2) pneumatic control - compressed air, valves, etc.
3) electromechanical control - switches, relays, a timer,
counters, etc,
4) electronics control - similar to electromechanical
control, except uses electronic switches.
5) computer control.
PROGRAMMABLE LOGIC
CONTROLLER
Invented in 1968 as a substitute for hardwired relay panels.

"A digitally operating electronic apparatus which uses a


programmable memory for the internal storage of
instructions by implementing specific functions such as logic
sequencing, timing, counting, and arithmetic to control,
through digital or analog input/output modules, various
types of machines or processes. The digital computer
which is used to perform the functions of a programmable
controller is considered to be within this scope. Excluded
are drum and other similar mechanical sequencing
controllers."
National Electrical Manufacturing Association (NEMA)
VENDORS
Rockwell
GE/Fanuc
Schnieder
etc.
PLC
Input
CPU Input
Module
Flag
System
Output
Output Module
User Ladder
Diagram

Working
memory
registers
PLC Configuration
What devices does a PLC interact with?
• INPUT RELAYS-(contacts)These are connected to the outside
world. They physically exist and receive signals from switches,
sensors, etc. Typically they are not relays but rather they are
transistors.
• INTERNAL UTILITY RELAYS-(contacts) These do not receive
signals from the outside world nor do they physically exist. They are
simulated relays and are what enables a PLC to eliminate external
relays. There are also some special relays that are dedicated to
performing only one task. Some are always on while some are always
off. Some are on only once during power-on and are typically used for
initializing data that was stored.
• COUNTERS-These again do not physically exist. They are simulated
counters and they can be programmed to count pulses. Typically these
counters can count up, down or both up and down. Since they are
simulated they are limited in their counting speed. Some
manufacturers also include high-speed counters that are hardware
based. We can think of these as physically existing. Most times these
counters can count up, down or up and down.
What devices does a PLC interact with?
Continued
• TIMERS-These also do not physically exist. They come in many
varieties and increments. The most common type is an on-delay type.
Others include off-delay and both retentive and non-retentive types.
Increments vary from 1ms through 1s.
• OUTPUT RELAYS-(coils)These are connected to the outside world.
They physically exist and send on/off signals to solenoids, lights, etc.
They can be transistors, relays, or triacs depending upon the model
chosen.
• DATA STORAGE-Typically there are registers assigned to simply
store data. They are usually used as temporary storage for math or
data manipulation. They can also typically be used to store data when
power is removed from the PLC. Upon power-up they will still have
the same contents as before power was removed. Very convenient
and necessary!!
SWITCHES
Non-locking Locking

Normally Open Normally Closed

P1
Double pole
Single Pole single throw
P2
(DPST)
Double Multiple Throw Multiple Pole
switch
Throw
(SPDT

Break-before-make Make-before-break
TERMS
Throw - number of states
Pole - number of connecting moving parts (number of individual circuits).

SPDT
A serial switch box (A-B box) has
two 25 pin serial ports to switch from.

A B

Output
DPST Input

Knob
TYPES OF SWITCHES
1. Basic switch, operated by a mechanical level,
2. Push-button switch,
3. Slide switch,
4. Thumbwheel switch,
5. Limit switch,
6. Proximity switch, and
7. Photoelectric switch.

RATING: voltage, current


RELAYS
A switch whose operation is activated by an electromagnet is called a "relay"

contact

coil

input

Relay coil Output contact


COUNTER
Digital counters output in the form of a relay contact when a
preassigned count value is reached.
input
Register

Accumulator
reset

contact

output

Input

Rese t

Output

Count 0 12 3 4 5 0 1
TIMER
A timer consists of an internal clock, a count value register,
and an accumulator. It is used for or some timing purpose.

Clock

Accumulator
reset

Register

Clock
contact
Contact
Reset
output

Output

Count 0 1 2 3 4 5

Time 5 seconds.
AN EXAMPLE OF RELAY LOGIC
For process control, it is desired to have the process start (by turning
on a motor) five seconds after a part touches a limit switch. The
process is terminated automatically when the finished part touches a
second limit switch. An emergency switch will stop the process any
time when it is pushed.

L1
LS1 PB1 LS2 R1

R1

TIMER R2
R1

PR=5
PLC ARCHITECTURE
Programmable controllers replace most of the relay panel
wiring by software programming.
PC
Program
Loader
Switches

Printer
I/O
Processor
Modules Machines
Cassette
Loader
Power
EPROM Memory Supply
Loader

Per ipherals External Devices

A typical PLC
PLC COMPONENTS
1. Processor Microprocessor based, may allow arithmetic
operations, logic operators, block memory moves,
computer interface, local area network, functions, etc.

2. Memory Measured in words.


ROM (Read Only Memory),
RAM (Random Access Memory),
PROM (Programmable Read Only Memory),
EEPROM (Electronically Erasable Programmable
ROM),
EPROM (Erasable Programmable Read Only Memory),
EAPROM (Electronically Alterable Programmable
Read Only Memory), and
Bubble Memory.
PLC COMPONENTS
3. I/O Modular plug-in periphery
AC voltage input and output,
DC voltage input and output,
Low level analog input,
High level analog input and output,
Special purpose modules, e.g.., high speed timers,
Stepping motor controllers, etc. PID, Motion
4. Power supply AC power
5. Peripheral Hand held programmer (loader),
CRT programmer,
Operator console,
Printer,
Simulator,
EPROM loader,
Cassette loader,
Graphics processor, and
Network communication interface. MAP, LAN
Ladder Diagrams
As an introduction to ladder diagrams, consider the simple wiring
diagram for an electrical circuit in Figure 11.1a. The diagram shows the
circuit for switching on or off an electric motor. We can redraw this
diagram in a different way, using two vertical lines to represent the input
power rails and stringing the rest of the circuit between them. Figure
11.1b shows the result. Both circuits have the switch in series with the
motor and supplied with electrical power when the switch is closed. The
circuit shown in Figure 11.1b is termed a ladder diagram.
Ladder Diagrams

With such a diagram the power supply for the circuits is always shown as
two vertical lines with the rest of the circuit as horizontal lines. The
power lines, or rails as they are often termed, are like the vertical sides of
a ladder with the horizontal circuit lines like the rungs of the ladder. The
horizontal rungs show only the control portion of the circuit; in the case
of Figure 11.1 it is just the switch in series with the motor.
Circuit diagrams often show the relative physical location of the circuit
components and how they are actually wired. With ladder diagrams no
attempt is made to show the actualphysical locations and the emphasis is
on clearly showing how the control is exercised.
Ladder Diagrams

Figure 11.2 shows an example of a


ladder diagram for a circuit that is
used to start and stop a motor using
push buttons. In the normal state, push
button 1 is open and push button 2
closed. When button 1 is pressed, the
motor circuit is completed and the
motor starts.
Also, the holding contacts wired in parallel with the motor close and
remain closed as long as the motor is running. Thus when the push
button 1 is released, the holding contacts maintain the circuit and hence
the power to the motor. To stop the motor, button 2 is pressed. This
disconnects the power to the motor and the holding contacts open. Thus
when push button 2 is released, there is still no power to the motor. Thus
we have a motor which is started by pressing button I and stopped by
pressing button 2.
PLC Ladder Programming
In drawing a ladder diagram, certain conventions are adopted:

1. The vertical lines of the


diagram represent the power
rails between which circuits
are
connected. The power flow is
taken to be from the left-hand
vertical across a rung.
2. Each rung on the ladder
defines one operation in the
control process.

3. A ladder diagram is read from left to right and from top to bottom,
Figure 11.3 showing the scanning motion employed by the PLC. The top
rung is read from left to right. Then the second rung down is read from
left to right and so on.
PLC Ladder Programming
In drawing a ladder diagram, certain conventions are adopted:
When the PLC is in its run mode, it goes through the entire ladder
program to the end, the end rung of the program being clearly denoted,
and then promptly resumes at the start. This procedure of going through
all the rungs of the program is termed a cycle. The end rung might be
indicated by a block with the word END or RET for return, since the
program promptly returns to its beginning.

4. Each rung must start with an input or inputs and must end with at least
one output. The term input is used for a control action, such as closing
the contacts of a switch, used as an input to the PLC. The term output is
used for a device connected to the output of a PLC, e.g., a motor.

5. Electrical devices are shown in their normal condition. Thus a switch,


which is normally open until some object closes it, is shown as open on
the ladder diagram. A switch that is normally closed is shown closed.
PLC Ladder Programming
In drawing a ladder diagram, certain conventions are adopted:

6. A particular device can appear in more than one rung of a ladder. For
example, we might have a relay that switches on one or more devices.
The same letters and/or numbers are used to label the device in each
situation.
7. The inputs and outputs are all identified by their addresses, the
notation used depending on the PLC manufacturer. This is the address of
the input or output in the memory of the PLC.
LADDER DIAGRAM
A ladder diagram (also called contact symbology) is a
means of graphically representing the logic required in
a relay logic system.

Rail
start emergency stop
PB1 PB2
R1

Rung R1

R1
A
Ladder Representation
PLC WIRING DIAGRAM

Input PLC Output

01 01 02 20 11 A
02 12
20
03
20 11

External
switches

Stored program
SCAN
A PLC resolves the logic of a ladder diagram (program) rung by rung,
from the top to the bottom. Usually, all the outputs are updated based on
the status of the internal registers. Then the input states are checked and
the corresponding input registers are updated. Only after the I/Os have
been resolved, is the program then executed. This process is run in a
endless cycle. The time it takes to finish one cycle is called the scan
time. Output
Input
begin

Idle

Scan cycle

Resolve
logic
PLC INSTRUCTIONS
1) Relay,
2) Timer and counter,
3) Program control,
4) Arithmetic,
5) Data manipulation,
6) Data transfer, and
7) Others, such as sequencers.
LOGIC STATES
ON : TRUE, contact closure, energize, etc.
OFF: FALSE, contact open , de-energize, etc.
Do not confuse the internal relay and program with the external
switch and relay.
Internal symbols are used for programming.
External devices provide actual interface.
(In the notes we use the symbol "~" to represent negation. AND
and OR are logic operators. )
AND and OR LOGIC
PB1 PB2 R1

R1 = PB1.AND.PB2

AND PB3 PB4


R2
R2 = PB2.AND.~PB4

PB1 R1

R1 = PB1 .OR. PB2

OR PB2
COMBINED AND & OR

R1 = PB1 .OR. (PB2 .AND. PB3)

PB1 R1

PB2 pb3
RELAY
A Relay consists of two parts, the coil and the contact(s).

Contacts:

a. Normally open -| |-
b. Normally closed -|/|-
c. Off-on transitional -||-
d. On-off transitional -| |-

()
Coil:

a. Energize Coil -( )-
b. De-energize -(/)-
c. Latch -(L)-
d. Unlatch -(U)-
TIMERS AND COUNTERS
Input
True False True
Timers: RTO counting stop counting
resume
a. Retentive on delay -(RTO)- RTF stop counting stop
b. Retentive off delay -(RTF)-
c. Reset -(RST)-
RTO reach PR value, output ON
RTF reach PR value, output OFF
Counter:
PR value in 0.1 second
a. Counter up -(CTU)-
b. Counter down -(CTD)-
c. Counter reset -(CTR)-
SEQUENCER
Sequencers are used with machines or processes involving repeating
operating cycles which can be segmented into steps.

Output
Step A B C Dwell time
1 ON OFF OFF 5 sec.
2 ON ON OFF 10 sec.
3 OFF OFF ON 3 sec.
4 OFF ON OFF 9 sec.
Rockwell/ Allen Bradley PLC
I/O points are numbered, they correspond to the I/O
slot on the PLC.
I/O uses 1-32
Internal relays use 033 - 098
Internal timers/counters/sequencers use 901-932
Status 951-982
Programming a PLC
Oil is consumed randomly.
The tank needs to be
refilled by turning on a
pump. Two hydrostatic
switches are used to detect
a high and low level.
Ladder Logic for Tank
Logic for Ladder Solution
Logic for Ladder Solution
When the water level is below both switches, the float switch physical contacts are both
closed, and a true (logic 1) value is passed to the Fill Valve output. Water begins to fill
the tank. The internal "Fill Valve" contact latches the circuit so that even when the "Low
Level" contact opens (as the water passes the lower switch), the fill valve remains on.
Since the High Level is also normally closed, water continues to flow as the water level
remains between the two switch levels. Once the water level rises enough so that the
"High Level" switch is off (opened), the PLC will shut the inlet to stop the water from
overflowing; this is an example of seal-in (latching) logic. The output is sealed in until a
high level condition breaks the circuit. After that the fill valve remains off until the level
drops so low that the Low Level switch is activated, and the process repeats again.
How does it work?
How does it work?
Programmable Logic Controllers (PLC)
Industrial control circuits are designed to serve several functions:
i. Switching: It is necessary to switch on control elements to operate
actuators like hydraulic cylinders, electric motors, pneumatic valves etc.
For example, a pneumatic or hydraulic cylinder may be used to actuate
the door closing function in a CNC machine.
ii. Sequencing: Certain functions in machines should be performed in a
particular order. For example, if two cylinders, shown in Fig. 11.2 are to
be operated in sequence, the sequence may be any one of the following:

“- “ Symbol denotes the movement of the cylinder in


the reverse direction.
For example, the sequence ABB-A- means:
• Cylinder A moves forward first
• Cylinder B moves forward next
• Cylinder A retracts and then
• Cylinder B retracts
Programmable Logic Controllers (PLC)
iii. Process Control: A PLC may be used to control a process on the basis
of signals received from a process. The signals may be analog or digital.
PLC is a microprocessor-based unit that carries out control functions of
many levels and complexity. PLC is used to monitor process parameters
in industries and adjust process control parameters on the basis of a built-
in logic. It is user-friendly and can be operated by even unskilled
persons.
Typical PLC applications are listed below:
(a) Switching functions in a CNC machine tool like spindle motor on/off,
coolant motor on/off, chuck opening and closing, tailstock
forward/reverse, door close/ open, guard open/close, pallet change etc.
(b) Operation of lifts in buildings.
(c) Control of electric motors in industrial drives.
(d) Transfer machine control.
(e) Heating control in process industries.
(f) Control of traffic signals.
Programmable Logic Controllers (PLC)
Typical PLC applications are listed below:
(g) Safety control of presses.
(h) Robot control.
(i) Home and medical equipment.
PLC is widely used because of several of its advantages, some of which
are described in the following sections:
(i) Flexibility: A PLC can be used for controlling one machine or a group
of machines. A PLC program can be altered easily through a keyboard
sequence so that the machine functions can be modified at the will of the
designers without incurring additional cost of hardware or scrapping
existing hardware.
(ii) Low cost: Technological developments in microelectronics
technology have reduced the cost of PLC’s considerably.
(iii) Speed of operation: PLC’s operate faster than relays.
(iv) Security: A PLC program cannot be altered without unlocking the
program.
Programmable Logic Controllers (PLC)
(v) Reprogramming: In the case of transfer machines the modifications
in the control circuit can be carried out by simple reprogramming so that
same hardware can be used for a new sequence.
(vi) Modularity: PLC’s can be assembled in a modular fashion. The
designer can add modules depending upon his requirement of the number
of inputs and outputs.
(vii) Analog and digital inputs: PLC can input/output both analog and
digital signals.
(viii) Correction of errors: Efficient debugging procedure enables easy
error correction.
(ix) Off-line programming: PLC program can be designed off-line and
tested before implementation.
(x) Boolean programming: PLC programming can be carried out using a
ladder diagram by an experienced technician.
(xi) Documentation: PLC programming devices can generate a printout
as soon as the ladder diagram is completed. This avoids the need for
separate documentation efforts.
Programmable Logic Controllers (PLC)
(xii) Reliability: Since PLC is a solid-state device the reliability is very
high.
(xiii) Maintainability: The modular nature of the PLC design makes
maintenance easy.
PARTS OF A TYPICAL PLC SYSTEM

Figure 11.3 shows


the block diagram
of a PLC system.
It consists of four
major parts,
which are briefly
described below:
PARTS OF A TYPICAL PLC SYSTEM
(i) The central processing unit (CPU): Like a computer this is the brain
of a PLC. It has several sub-parts.
(a) A microprocessor to carry out arithmetic and logic operations.
(b) Memory to store data and programs.
(c) Process image memory.
(d) Internal timers and counters.
(e) Flags.
(ii) Input module: This acts as an interface between the field inputs and
the CPU. The input module accepts voltage signals from the limit
switches, sensors, transducers, proximity switches, push buttons etc. The
input signals can be analog or digital.
The input module performs four tasks.
• It senses the presence or absence of input signals at each of its input
terminals. The input signal tells what switch, sensor, or other signal is on
or off in the operation being controlled.
• It converts the input signal to a DC level useable by the PLC’s
electronic circuit.
PARTS OF A TYPICAL PLC SYSTEM
• The input module carries out electronic isolation of output from input.
• It produces an output sensed by CPU.
A typical input module will have 4, 6, 8, 12, 16, or 32 terminals.

(iii) Output module: The output module interfaces the output devices like
contactors, lamps, relays, solenoid valves etc. with the CPU. The output
module acts in just opposite manner to input module. A signal from CPU
is received by the output module, once for each scan. If the CPU signal
code matches the assigned number of the module the module is turned
on. The output modules will have 4,6,8,12,16 or 32 terminals.
(iv) Power supply
(v) Racks and chassis to mount the elements
OPERATION OF A PLC
Figure 11.4 shows the operational sequence of a PLC. The PLC system
software executes the user program. The speed with which the operations
are carried out will depend upon the specifications of the microprocessor.
The usual method of operation of a PLC is to scan all the inputs, process
the user program and then scan all outputs. This is called a scan cycle.

A typical PLC Function


module for Axis Control in
Fig. 11.4 Operation of a PLC a CNC
PROGRAMMING OF PLC
Entering and storing a sequence of instructions in the memory of the
PLC either can be carried out by a hand-held programming device or
using a personal computer. The programming can be done either on-line
or off-line as desired by the programmer.
OFF-LINE PROGRAMMING
Off-line programming is used to design programs prior to running the
machine. This permits the programs to be checked prior to
implementation and detect any bug in the program. This is the preferred
method of programming.
ON-LINE PROGRAMMING
On-line programming is implemented with the direct connection to the
PLC. Changes in the program are made when the PLC is in the running
mode.
LADDER LOGIC
The type programming used for PLC is ladder logic. This is a graphical
representation of the hard-wired system used in electrical circuits and
includes switches, timers, counters, and many other pieces of hardware
in a structured manner. Figure 11.5 shows one rung of a circuit diagram
and the corresponding ladder diagram.
The left hand of the ladder
diagram is the live supply
and the right hand is the
neutral or common line. The
flow of control is from left to
right. The operation of the
ladder logic can be explained
with the help of a simple
example of starting an
electric motor. Figure 11.6
shows a single rung motor
starter circuit.
LADDER LOGIC
The activation of the motor will
occur when all the input devices on
the rung will provide continuity from
left to right to the output device.
However, this cannot be used practically. Another path to the motor is
needed to keep the motor running. This is shown in Fig. 11.7. When the
start button is depressed the motor will start and the relay contact parallel
to the start button will close. When the start button is released current
will flow through the relay contact until the stop button is pressed. This
will open the relay contact and stop the motor. In terms of the Boolean
logic the motor will run if:

(Start depressed OR IR relay closed)


AND (STOP closed).
Now this can be programmed in the
PLC software using contact symbols
as shown in Fig. 11.7.
EXAMPLE OF APPLICATION OF PLC IN A CNC MACHINE
In CNC machines PLC is used for realizing several functions. In some
machines PLC is integral with the CNC system. In most of the machines
PLC is separate. The PLC program is designed by the manufacturer of
the machine to satisfy the specification requirements of the machine. The
input/output of a PLC in a CNC lathe is given in Table 11.1.
Table 11.1 PLC Input/Output for a Lathe
EXAMPLE OF APPLICATION OF PLC IN A CNC MACHINE
The ladder diagram for the machine is shown in Fig. 11.8 (a) and (b). A
careful reading of the ladder diagram will reveal that the switching
functions are effectively managed by the PLC in a flexible manner

Fig. 11.8 (a) One Section of PLC Ladder Diagram


EXAMPLE OF APPLICATION OF PLC IN A CNC MACHINE

Fig. 11.8 (a) One Section of PLC Ladder Diagram


Fig. 11.8 (b) Another Section of PLC Ladder Diagram
PROGRAMMING EXAMPLE 1 Bar code reader
microswitch Stopper

Part Conveyor

Robot
Machine

id description state explanation


MSI microswitch 1 part arrive
R1 output to bar code reader 1 scan the part
C1 input from bar code reader 1 right part
R2 output robot 1 loading cycle
R3 output robot 1 unloading cycle
C2 input from robot 1 robot busy
R4 output to stopper 1 stopper up
C3 input from machine 1 machine busy
C4 input from machine 1 task complete
Input
SOLUTION
Output
MS1 R1
01 11
C1 02 12 R2
C2 R3
03 13
C3 R4
04 14
C4 Programmab le
05 Contro ller 15
PLC
Rung 1. If part arrives and no
part is stopped, trigger the
bar code reader.
01 14 11 Rung 2. If it is a right part,
activate the stopper.
02 14 Rung 3. If the stopper is up,
the machine is not busy
12
and the robot is not busy,
14 04 03
load the part onto the
machine.
05 03 13
Rung 4. If the task is
completed and the robot is
not busy, unload the
machine.
EXAMPLE 2 TRAFFIC LIGHTS
Main street

Jefferson street

Cycle time

Street Red Yellow Green

Main 3 1 4
Jefferson 5 1 2
WIRING DIAGRAM
input output

64 Jefferso n Red

65 Jefferso n Yellow
Programmable
Controller
66 Jefferso n Green

67 Main Red

70 Main Yellow

71 Main Green
PROGRAM (1) 901
RUNG1 RTO
80
901 901
RUNG2 RST
901 902
RUNG3 67 M. Red

902
RUNG4 67
RTO
30
RUNG5 901 902
RST
901 903
RUNG6 66 J. Green

903
RUNG7 66
RTO
901 903 20
RUNG8 RST
902 904 M. Green
RUNG9 71

904
71
RUNG10 RTO
901 904 40
RUNG11 RST
904 905
RUNG12 70 M. Yellow
PROGRAM (2)
905
70
RUNG13 RTO
901 905 10
RUNG14 RST
903 906
RUNG15 65 J. Yellow

906
65
RUNG16 RTO
901 906 10
RUNG17 RST
902 907
RUNG18 64 J. Red

907
RUNG19 64
RTO
901 907 50
RUNG 20 RST

You might also like