Chapter 2 Powerpoint
Chapter 2 Powerpoint
Introduction to
Programmable Logic Controller (PLC)
PICG 433 chapter 2 PLC
Introduction
Relay sequencers were used in the early day for the control of industrial processes.
They are made of physical relays wired together (or programmed) to make the processes
under control executes a desired sequence of events.
If the event sequence is to be changed, it is necessary to rewire all or part of the relay
sequencer. It may even be necessary to add more relays to the system or use more
relays than in the previous wiring. Obviously, such a task is quite hard and time
consuming.
With the development of reliable computers, it was than an easy decision to replace relay
logic panels with computer-based controller, i.e. PLCs.
PICG 433 chapter 2 PLC
RELAY CONTROLLERS
Example of a small switch used to energize a relay with contact ratings that
can handle the heavy load, such as that shown in Figure below.
RELAY SEQUENCER
When an entire control system is implemented using relays, the
system is called a relay sequencer.
Inputs are switches and push buttons that energize relays, and outputs
are closed contacts that can turn lights on or off, start motors, energize
solenoids, and so on.
PICG 433 chapter 2 PLC
Physical Ladder Diagram Elements
The ladder diagram is a symbolic and schematic way of representing
both the system hardware and the process controller.
Elevator system
Elevator system
A simplified ladder diagram
PICG 433 chapter 2 PLC
Programmable Logic Controller (PLC)
Replacement of relay logic controllers by computer-based controllers called
programmable logic controller (PLC) in modern industries:
1. The input and output variables of discrete state control systems are binary in
nature, just as with a digital computer.
2. Many of the “control relays” of the panel can be replaced by software, which
means less hardware failure.
4. Special functions, such as time delay actions and counters, are easy to
produce in software.
1. Processor,
2. Memory,
3. Input/Output modules,
4. Programming language
5. Power Supply.
Processor
For example, a 32- bit microprocessor can manipulate data faster than
a 16-bit micro, since it manipulates twice as much data in one
operation.
Word length correlates with the capability and degree of sophistication
of the controller (i.e., the larger the word length, the more sophisticated
the controller).
PICG 433 chapter 2 PLC
In smaller PLCs the inputs are normally built in and are specified when
purchasing the PLC.
For larger PLCs the inputs are purchased as modules, or cards, with 8 or 16
inputs of the same type on each card. The list below shows typical ranges
for input voltages, and is roughly in order of popularity.
12-24 Vdc,100-120 Vac, 10-60 Vdc, 12-24 Vac/dc, 5 Vdc (TTL), 200-240
Vac, 48 Vdc, 24 Vac
PLC input cards rarely supply power, this means that an external
power supply is needed to supply power for the inputs and sensors.
Typical Discrete Input Module wiring circuit
Output Module
The output modules supply power to an external device such as a motor, light,
solenoid, and so on, as required by the ladder diagram.
The output module is designed to input the processor digital output and use this to
activate relays, SCRs, TRIACs, BJTs, and other solid-state switches that can handle
the high-power ac requirements
Rack - A rack is often large (up to 18” by 30” by 10”) and can hold
multiple cards. When necessary, multiple racks can be connected
together. These tend to be the highest cost, but also the most flexible
and easy to maintain.
Mini - These are similar in function to PLC racks, but about half the
size.
Power supply
The power supply converts ac line voltages to dc voltages to power the electronic circuits
in PLC.
These power supplies rectify, filter, and regulate voltages and currents to supply the
correct amounts of current and voltage to the system.
The power supply for PLC may be integrated with the processor, memory and I/O
modules into a single housing or it might be separated unit connected to the system
through a cable.
PICG 433 chapter 2 PLC
During the input scan, the PLC examines the external input devices to see if a
signal is present or absent, that is, if the input devices are in ON or OFF state.
The status of these inputs is temporarily stored in an input image table or memory
file.
During the program scan, the processor scans the instruction in the control program,
uses the inputs from the input image file, and determines if an output will or will not
be energized.
The resulting status of the outputs is written to the output image table or memory file.
Based on the data in the output image table, the PLC energize or deenergize its
associated output circuits, which control external devices.
Scan time
An important characteristic of the PLC is how much time is required for one
complete cycle of I/O scan and execution.
Scan time depends on how many input and output channels are involved and
on the length of the ladder diagram program.
The speed of the controller depends on the clock frequency of the processor.
The higher the clock frequency, the greater the speed, and the faster the
scan/execution time.
The length of time for one scan consists of three parts: (1) input time, (2)
execution time, and (3) output time. Most of the scan time comes from the
execution phase.
Assignment
Assignment on PLC
Programming Unit
The programming unit are used to enter, store, and monitor the programmable
controller software.
They can be hand held systems or personal computer based systems.
Once the program has downloaded in the memory of the PLC, the program unit can be
disconnected and the PLC operate the process according to the program downloaded
by user.
There is danger of loss of the program because of power failure, but this can be
prevented by placing the program into the permanent memory.
The additional feature of computer based programming units is that they can be
connected to Ethernet type local area network (LAN) or dedicated control networks such
as Foundation Fieldbus or Profibus.
This network give the programmer or engineer access to any PLC in the network, so it is
possible to monitor and control any PLC in the network.
Hand Held Programming Units
Hand held programming units are inexpensive and portable; they are normally used to
program small PLCs.
Most of these devices resemble portable calculators but with larger displays and
somewhat different keyboard.
Desktop Programming Unit
The personal computer based systems employ keyboard and mouse; color
graphic display; personal computer; printer; communication interface and cable.
Programming Languages
The programming language allows the user to communicate with the programmable logic
controller via a programming device.
PLC manufacturers use several different programming languages, but they all use
instructions to convey a basic control program to the system.
Five common types of languages encountered in PLC systems are as follows
Graphical languages
Ladder Logic (LAD)
Function Block Diagram (FBD)
Text-based languages
STatement List (STL)
Structured text (ST)
Flow chart-type
• Sequential Function Charts (SFC) - Grafcet
All these programming languages are part of the IEC 61131 standard.
The IEC Standard allows some ground rules that standardize PLC's and
their languages.
PICG 433 chapter 2 PLC
Ladder diagram
The logic function shown is an AND function, that is, if pushbutton (PB1) is closed and
pushbutton (PB2) is closed then the GO light is on.
The ladder diagram is the most common language used in PLC applications. This is
because ladder diagrams have already been used by technicians and engineers in the
design of the relay sequencers.
PICG 433 chapter 2 PLC
Statement list
Statement list is a textual programming language that can be used to create the code for
a PLC control program.
Its syntax for statement is similar to microprocessor assembly language and consists of
instructions followed addresses on which instructions act.
Structured Text
It allows the programmer to build complex control procedures by taking existing functions
from the FBD library and wiring them in graphic diagram area.
LAD program
In this chapter, we discuss only ladder diagram applications. Before, we have to put in
mind that the PLC has no “real” relay or relay contacts.
The only real devices are those that are actually part of the process being controlled- that
is, limit switches, motors, solenoids, and so on.
In the LAD program addresses are used to identify both the physical and software
devices according to the following categories:
EXAMINE-
ON/NORMALLY OPEN
EXAMINE-
OFF/NORMALLY
CLOSED
Example on ladder relay coil status
Example on relay instruction
Reading of LAD diagram
PICG 433 chapter 2 PLC
Some PLC may reserve certain address for physical I/O devices, other addresses for
software control relays, and for special functions.
For some examples to be considered in this chapter, we will use the following addresses
PICG 433 chapter 2 PLC
Counter
Timers
Accumulating Timers
One-shot
Shift register
Modern PLCs are able to handle multi-digit numbers as well as single-bit, binary numbers.
Thus, it is possible for a PLC to accept input from an 8-bit ADC and store the result in a
known memory location or register. These PLCs have the ability to perform a variety of
math operations on this data, from simple addition, subtraction, multiplication, and
division, to exponential and trigonometric operations. In this way, the PLC can be made to
process continuous plant data such as PID control.
PICG 433 chapter 2 PLC
Example
Implementation of latch to turn on and off a motor using two NO push-button switches.
PICG 433 chapter 2 PLC
Example
Timer instructions may have one or more time bases (TB) which they use to
time an event. The time base is the resolution, or accuracy, of the timer. For
instance, if a timer must time a 10 second event, the user must choose the
number of times the time base must be counted to get to 10 seconds.
Counter instructions are used to count events, such as parts passing on a conveyor, the
number of times a solenoid is turned ON, etc. Counters, along with timers, must have two
values, a preset value and an accumulated value.
Timer instructions
Counters instructions
PICG 433 chapter 2 PLC
A counter is programmed function that counts (increments) every time the input
changes from False or True.
This means that, if in one scan the input is False and in the next scan is True,
the counter increments.
No further counts will occur until the input goes False again and then True.
PICG 433 chapter 2 PLC
Example
Solution
Figure 36 shows the conveyor with multiple objects and
how a counter can be connected to the object detector
so that the conveyor is turned off after counting 200
objects. The object detector is connected to input
channel 01, and the conveyor motor to output channel
08. The counter is assigned address 32, and the count is
preset to 200.
This means that, when a count of 200 occurs, the
counter will become true. When it becomes true, the
EXAMINE OFF contact 32 in the third rung will become
false, and the conveyor motor will turn off.
Input channel 02 is unspecified but would be used to
reset the counter to start another count of 200.
PICG 433 chapter 2 PLC
Each tick is worth a certain amount of time. Typical of tick time is 10 ms and
100 ms.
The timer is pre-loaded with a specified number of these ticks. When the
accumulated time ticks equals the pre-load value, the timer itself becomes true.
If the input becomes False and then True again, the timer will reset to zero and
start to count again.
PICG 433 chapter 2 PLC
Example
Show how a timer can be used to turn a red light on for 2500 ms when a NO
start push button is pushed. The PLC timer tick is 10 ms. An NC stop button
resets the system.
PICG 433 chapter 2 PLC
We need a preset tick count of 2500 ms/l0 ms = 250. Let’s use address 33 for the timer,
01 for the push button, and 08 for the red light. We need to latch the effect of the start
push button, since it will likely not be held for the full 2500 ms. Figure 8.38 shows the
programmed ladder diagram. The stop button is used to reset the process. Without the
latch, the timer would only count while the push button is held down.
PICG 433 chapter 2 PLC
Accumulating Timers
The accumulator timers retain a tick count when its input goes false.
When the input goes true again, the tick count will pick up where the previous
one left off.
Example
Figure shows a P&ID of a chemical vat in which a mixture must be cooked at a
temperature greater than 100°C for 10 minutes. Due to external influences, the
temperature might fall below 100°C periodically, and this should not be counted in the
cooking time. After the vat is filled, a Start push button (NC) starts the cooking. It is
terminated by an NC Stop push button. A thermal switch goes high when the temperature
is above 100°C. When the mixture has been cooked for 10 minutes at 100°C, the heater
should be turned off and the drain valve opened. The PLC tick time is 10 ms.
PICG 433 chapter 2 PLC
Solution
Since the tick marks are 10 ms, the required count is (60 s/min)(lO min)/(10 ms) = 6000
counts. A start/stop latch is used with a programmed control relay to start the process
with the NC switches addressed at 01 and 02. The accumulating timer (address 32) will
count long as the start is latched and the temperature is above 100°C as indicated by
the thermal switch, address 03. As long as the timer has not timed out, the heater is on
and the valve closed. When the timer times out, the heater is turned off and the valve is
opened. The timer is reset by pressing the stop button. Figure shows the programmed
ladder diagram for this system.
PICG 433 chapter 2 PLC
Example
Prepare the physical and programmed ladder diagram for the control
problem shown in Figure 8.41. The global objective is to heat a liquid to
a specified temperature and keep it there with stirring for 30 min.
The hardware has the following characteristics:
• 1. START push button is NO, STOP is NC.
• 2. NO and NC are available for the limit switches.
• The event sequence is
• 1. Fill the tank.
• 2. Heat and stir the liquid for 30 min.
• 3. Empty the tank.
• 4. Repeat from step 1.
PICG 433 chapter 2 PLC
Inputs:
01 = NO Start switch
02 = NC Stop switch
03 = Full level switch (opens
on rising
level)
04 = Temperature switch
(opens on rising
temperature)
05 = Empty switch
(closes on rising
level)
Outputs:
08 = Input valve
09= Stir motor
10 = Heater
11 = Output valve
Timer tick = 1 second
PICG 433 chapter 2 PLC
Solution
• The solution is provided by first constructing the physical ladder diagram.
Once this is done, addresses are assigned to all the elements, and the
ladder diagram program prepared.
• Figure below shows the six-rung physical ladder diagram.
• Rung 2 opens the input valve, provided the output valve is not open, until
the full level is reached.
• When the full level is reached, rung 3 turns on the stir, provided the output
valve is not open.
• Rung 4 starts a 30-min timer.
• The heater is controlled by rung 5. The rung is energized and de-energized
as the temperature goes below and above the limit.
• When the timer times out, the rung is de-energized, and rung 6 is energized
to open the output valve. The output valve remains open until the empty
limit switch opens.
• The output valve cannot be opened as long as the input valve is open.
• The programmed ladder diagram is shown in Figure below. Addresses for
the input, output, and internal devices have been assigned. Notes indicate
how the physical contacts change in response to the control variable. The
timer becomes True after 1800 ticks or 30 minutes, so we use an EXAMINE
OFF for the timer in rung 5 to assure that the heater can be on only during
the 30 minutes the timer is not True. Since the empty valve closes on a
rising level, it will be closed until the tank empties. Therefore, we use an
EXAMINE ON to assure that the output valve stays open until the tank is
empty.
PICG 433 chapter 2 PLC
Inputs:
01 = NO Start switch
02 = NC Stop switch
03 = Full level switch
(opens on rising
level)
04 = Temperature
switch
(opens on rising
temperature)
05 = Empty switch
(closes on rising
level)
Outputs:
08 = Input valve
09= Stir motor
10 = Heater
11 = Output valve
Timer tick = 1 second
Inputs:
01 = NO Start switch
02 = NC Stop switch
03 = Full level switch
(opens on rising
level)
04 = Temperature
switch
(opens on rising
temperature)
05 = Empty switch
(closes on rising
level)
Outputs:
08 = Input valve
09= Stir motor
10 = Heater
11 = Output valve
Timer tick = 1 second
PICG 433 chapter 2 PLC
Other functions
The one-shot is an output that will go true for only one scan when its
input path is True.
This device is used for initialization and other instances when an event
is to occur only once, even though the conditions that make it True may
occur again.
A shift-register is used to remember a certain number of previous
states of a rung. A four-event shift register could be used to remember
the state of a rung for the latest four scans..
PICG 433 chapter 2 PLC
Other functions