Discrete Control
Using PLCs and PCs
Topics:
1. Discrete Process Control
2. Ladder Logic Diagrams
3. Programmable Logic Controllers
4. Personal Computers Using Soft Logic
Prof. Dr.-Ing. Saleh M. Chehade
Discrete Process Control
Control systems that operate on parameters and variables that change at
discrete moments in time
Parameters and variables are also discrete, usually binary (0 or 1,
meaning, off or on, true or false, open or closed, etc.)
The binary variables are associated with input signals to controller or
output signals from the controller (controller is to coordinate actions)
Input signals generated by Sensors
Limit switch Contact/no contact
Photo-detector On/off
Timer On/off
Output signals affect Actuators
Motor On/off
Valve Open/closed
Clutch Engaged/not engaged
Prof. Dr.-Ing. Saleh M. Chehade
Categories of Discrete Control
Referred to as switching systems, in the sense that they switch their
output values on and off in response to changes in events or time,
discrete process control can be divided into two categories:
1. Logic control – event-driven changes in the system
2. Sequencing – time-driven changes
Prof. Dr.-Ing. Saleh M. Chehade
Logic Control
A switching system whose output at any moment is determined
exclusively by the values of inputs
has no memory and doesn’t consider any previous values of input
signals in determining the output signal
has no operating characteristics that depend on time
Also called Combinational Logic Control
Prof. Dr.-Ing. Saleh M. Chehade
Logic Control
Example from Robotics to illustrate logic control
Robot hand programmed to pick up a workpart from a conveyor belt and place
it is a forging press
Three conditions must be satisfied for load cycle to start by controller
One: Workpart must be at the stopping point
Two: Forge press must have completed the process on the previous
part
Three: The previous part should have been removed from the die
Condition one
“ON” signal from the Limit Switch indicating presence of part for pick up
Condition two
“ON” signal from the Press indicating completion of job in hand
Condition three
“ON” signal by Photo Cell indicating workpart is removed
All the above “ON” signals must be sent to the robot controller to initiate the next
work cycle.
Prof. Dr.-Ing. Saleh M. Chehade
Elements of Logic Control
Basic elements, called logic gates:
AND – output = 1 if all inputs = 1, zero otherwise
OR – output = 1 if any input = 1, zero otherwise
NOT – output = 1 if (single) input = 0, and vice versa
Additional elements:
NAND – combination of AND and NOT
NOR – combination of OR and NOT
Prof. Dr.-Ing. Saleh M. Chehade
AND Gate
Electrical circuit illustrating the operation of the
logical AND gate.
Prof. Dr.-Ing. Saleh M. Chehade
OR Gate
Electrical circuit illustrating the operation of
the logical OR gate.
Prof. Dr.-Ing. Saleh M. Chehade
NOT Gate
Electrical circuit illustrating the operation
of the logical NOT gate.
Prof. Dr.-Ing. Saleh M. Chehade
Boolean Algebra & Truth Tables
AND function is expressed as
Y = X1.X2
OR function is expressed as
Y = X1+X2
NOT function is expressed as
Y=X1
Prof. Dr.-Ing. Saleh M. Chehade
NAND and NOR Functions
Prof. Dr.-Ing. Saleh M. Chehade
Symbols for Logical Gates:
U.S. and ISO
Prof. Dr.-Ing. Saleh M. Chehade
Example
Write the Boolean logic expression for the push button switch system
below used for starting and stopping electric motors and other powered
devices by using the following symbols:
X1 = START, X2 = STOP, Y1 = MOTOR, and Y2 = POWER-TO-MOTOR.
__
X2 X2
Y2
Y1
X1
Prof. Dr.-Ing. Saleh M. Chehade
Solution
__
X2 X2
Y2= ( X1 Y1) X 2
Y1
X1
X1+Y1
START – X1 = 0 is normally open contact status
START – X1 = 1 when the START button is pressed to contact
STOP – X2 = 0 is normally closed contact status
STOP – X2 = 1 when the STOP is pressed to break the contact
POWER-TO-MOTOR – Y2 = 0 when the contacts are open
POWER-TO-MOTOR – Y2 = 1 when the contacts are closed
MOTOR – Y1 = 0 when off (not runnng)
MOTOR – Y1 = 1 when on
Prof. Dr.-Ing. Saleh M. Chehade
Solution
__
X2 X2
Y2= ( X1 Y1) X 2
Y1
X1
X1+Y1
Truth Table
Prof. Dr.-Ing. Saleh M. Chehade
Sequencing
A switching system that uses internal timing devices to determine when to
initiate changes in output variables (washing machines, dishwashers, etc.)
Outputs are usually generated “open loop”
No feedback that control function is executed
Sequence of output signals is usually cyclical, as in a high production
work cycle
The signals occur in the same repeated pattern within each regular
cycle
Common sequencing devices:
Timer – output switches on/off at preset times
Delay-Off and Delay-On timers
Counter – counts electrical pulses and stores them
Up Counter & Down Counter
Prof. Dr.-Ing. Saleh M. Chehade
Ladder Logic
Ladder logic was originally a written method to document the design
and construction of relay racks as used in manufacturing and process
control.
Ladder logic has evolved into a programming language that represents
a program by a graphical diagram based on the circuit
diagrams of relay logic hardware.
Ladder logic is used to develop software for programmable logic
controllers (PLCs) used in industrial control applications.
The name is based on the observation that programs in this language
resemble ladders, with two vertical rails and a series of horizontal
rungs between them.
Prof. Dr.-Ing. Saleh M. Chehade
Ladder Logic Diagrams
A diagram in which various logic elements and other
components are displayed along horizontal rungs
connected on either end to two vertical rails
Types of elements and components:
1. Contacts - logical inputs (usually), e.g., limit
switches, photo-detector
2. Loads - outputs, e.g., motors, lights, alarms,
solenoids
3. The power (e.g. 115V AC) to the components
is powered by vertical rails
4. Timers - to specify length of delay
5. Counters - to count pulses received
Prof. Dr.-Ing. Saleh M. Chehade
Symbols for Common Elements
Used in Ladder Logic Diagrams
Prof. Dr.-Ing. Saleh M. Chehade
Normally Open / Normally Closed
• A normally open switch is like a door bell switch. It is open
until activated.
• A normally closed switch is often used when safety is a
concern. Your home garage door opener is a good example.
When there is something comes between the sensors when
the door is open, the door will not shut.
Prof. Dr.-Ing. Saleh M. Chehade
Example
Construct the ladder logic diagrams for (a) the NAND gate and (b) the
NOR gate.
Solution:
X1 X2 C
(a) NAND C Y
If X1 or X2 remain open then C coil is unexcited and C contact
remains closed, therefore Y is on.
If X1 and X2 are closed then C coil is excited and C contact is opened
and Y is off
Prof. Dr.-Ing. Saleh M. Chehade
Solution
C
X1
(b) NOR
X2
Y
C
If X1 and X2 remain open then C coil is unexcited and C
contact remains closed, therefore Y is on.
If X1 or X2 are closed then C coil is excited and C contact
is opened and Y is off
Prof. Dr.-Ing. Saleh M. Chehade
Exercise
The production process may only be performed when the operator
activates two spring activated safety switches. The switches have to
be depressed and held closed together by the operator using both
hands.
(a) What is the truth table? (b) What is the Boolean logic expression?
(c) What is the logic network diagram (in ISO symbol terminology)? (d)
What is the ladder logic diagram?
Assume X1 and X2 are the first and second switches and Y is the
output
Prof. Dr.-Ing. Saleh M. Chehade
Solution
(a) Truth table for the operation is as follows:
Where X1 is first switch, and X2 is second switch, and Y is the output of
switch activation.
Inputs Output
X1 X2 Y
0 0 0
0 1 0
1 0 0
1 1 1
(b) Boolean logic expression for this operation corresponds to the AND logic
gate, thus:
Y = X1 . X2
(c) The logic network diagram for the operation (in ISO symbol terminology) is
as follows:
(d) The ladder logic diagram for the system:
Prof. Dr.-Ing. Saleh M. Chehade
Multiple Contact Example
Hand Hand
Switch 1 Switch 2 Part Sensor Drill Motor
Prof. Dr.-Ing. Saleh M. Chehade
Exercise/Solution
Create ladder logic diagram for Push Button switch
( X1 Y1) X2
Prof. Dr.-Ing. Saleh M. Chehade
Parallel Contact Example
Front Door Switch
Doorbell
Rear Door Switch
Prof. Dr.-Ing. Saleh M. Chehade
Exercise/Solution
A tank is filled through an
electrically operated valve and
emptied by a motor-driven
pump.
Control must satisfy the
following logic:
Pump operates only when
input valve open.
Input valve can open at any
time.
(a) Process Tank
Prof. Dr.-Ing. Saleh M. Chehade
Exercise/Solution
Electronic Schematic
Operation:
1. Manually close S1—
relay A is energized.
2. A1 and A2 close NO
contacts.
3. Input valve is
energizes—tank fills.
4. Change in A2—no
immediate action
waiting for switch S2.
(b) Electronic schematic
Prof. Dr.-Ing. Saleh M. Chehade
Exercise/Solution
Control Ladder Diagram
(b) Control drawing (c) Single phase pump motor control
Prof. Dr.-Ing. Saleh M. Chehade
Exercise/Solution
Control Ladder Diagram
For pump to operate A2 and S1 are closed. If either open pump
stops.
Valve is controlled only by A1.
The control diagram called a Relay Ladder Logic (RLL) diagram
provides the same control.
RLL is the industry standard—gets name because relays are used,
looks like a ladder, and satisfies the logical control.
Prof. Dr.-Ing. Saleh M. Chehade
Advantages of Ladder Logic Diagrams
Familiar to shop personnel who must construct, test, maintain, and
repair the control system
Analogous to the electrical circuits used to accomplish logic and
sequence control
Principal technique for programming PLCs
Prof. Dr.-Ing. Saleh M. Chehade
Programmable Logic Controller (PLC)
A microcomputer-based controller that
uses stored instructions in
programmable memory to implement
logic, sequencing, timing, counting,
and arithmetic functions through digital
or analog modules, for controlling
machines and processes
Applications in both process
industries and discrete
manufacturing
Introduced around 1970
Replaced hard-wired
electromechanical relay panels
Prof. Dr.-Ing. Saleh M. Chehade
Advantages of PLCs Compared to
Relay Control Panels
Programming a PLC is easier than wiring a relay control panel
PLC can be reprogrammed
PLCs take less floor space
Greater reliability, easier maintenance
PLC can be connected to computer systems (CIM)
PLCs can perform a greater variety of control functions
Prof. Dr.-Ing. Saleh M. Chehade
PLC Components
1. Processor Unit – executes logic and sequencing functions by
operating on the PLC inputs to determine the appropriate output
signals
2. Input Section (Input Modules) – Received Input from real-world input
devices (Sensors, Robots, etc.), Protect CPU from outside world
3. Output Section (Output Modules) – connections to real-world output
devices (motor starters, valves, lights coils, etc.)
4. Memory unit – contains the programs of logic, sequencing, and I/O
operations
5. Power supply – converts 120 V (ac) to dc voltages of 5 V compatible
with process equipment
6. Programming device
Prof. Dr.-Ing. Saleh M. Chehade
Components of a PLC
Prof. Dr.-Ing. Saleh M. Chehade
Components of a PLC
Prof. Dr.-Ing. Saleh M. Chehade
PLC Components
Programming Processor I/O
Outputs
Device & Memory Module
Inputs
Prof. Dr.-Ing. Saleh M. Chehade
Typical Optical Isolation Circuit
Typical optical isolation circuit. The arrow represents
the fact that only light travels between the input circuitry and the
CPU circuitry. There is no electrical connection.
Prof. Dr.-Ing. Saleh M. Chehade
PLC System Block Diagram
Prof. Dr.-Ing. Saleh M. Chehade
PLC Rack and Modules
PLC processor, is the central
processing unit (CPU)—
handles logical operations
and performs mathematical
computations.
Processor is in slot 4.
Multiple processors can be in
any slot.
(a) Front panel and rack with seven modules for ControlLogix PLC
Power supply is left-most box
in the rack. Rack with power supply, processor, discrete
and analog modules, and field devices shown.
Prof. Dr.-Ing. Saleh M. Chehade
Programming Devices
(a) Handheld programmer
(b) Programmer keyboard
Programming devices are used to enter, download, and edit programs.
Prof. Dr.-Ing. Saleh M. Chehade
Typical PLC Operating Cycle
The process for each instruction involves three steps for each rung:
1. Input scan – inputs are read by processor and stored in memory
2. Program scan – control program is executed
Input values stored in memory are used in the control logic
calculations to determine values of outputs
3. Output scan – output values are updated to agree with calculated
values
The time to perform the three steps (scan time) varies between 1 and 25
msec
Prof. Dr.-Ing. Saleh M. Chehade
Additional PLC Capabilities
With special purpose modules, their capacity have expanded to include:
Analog control – PID control available on some PLCs for continuous
processes
Arithmetic functions – permits more complex control algorithms to be
implemented than conventional logic and sequencing elements
Matrix functions – capability of performing matrix operations on stored
values in memory, e.g., linear programming for optimal control
Bar-coding
Vision systems
Radio frequency communication
Voice recognition, and voice sythesizers
Data processing and reporting – business applications
Blurs the distinction between PLCs and PCs
Prof. Dr.-Ing. Saleh M. Chehade
PLC Applications
PLC’s are used to replace hardwired logic in older machines. This can
reduce the downtime and maintenance of older equipment
Process Control (flow, temperature, level, concentration, PH, and so
on)
Position and Velocity control
Grade, Size, and Cut lumber
Food processing
Electronic Assembly and Manufacturing
Many other application
Prof. Dr.-Ing. Saleh M. Chehade
PLC Programming
Programming is the means by which control instructions are entered
to the PLC
Basic control instructions are
Switching, Logic, Sequencing and Counting
Many control applications require additional instructions to accomplish
analog control of continuous processes, complex control logic, data
processing and reporting
A standard PLC programming was published by the International
Electromechanical Commission in 1992, entitled International
Standard for Programmable Controllers (IEC1131-3)
Prof. Dr.-Ing. Saleh M. Chehade
PLC Programming
IEC 1131-3 specifies the following:
Three Graphical languages:
1. Ladder Logic Diagrams (LD) – most widely used
2. Function Block Diagrams (FBD) – instructions composed of
operation blocks that transform input signals
3. Sequential Function Charts (SFC) – series of steps and
transitions from one state to the next (Europe)
Text-based languages:
1. Instruction List (IL) - low-level computer language
2. Structured Text – high-level computer language
Prof. Dr.-Ing. Saleh M. Chehade
PLC Solution
Tank Control Field Device Interface
Ladder Logic keeps the field devices, but the mechanical relay is
eliminate.
Input Switches connect to input modules; actuators are wired to output
modules.
Terminal numbers for connections to modules are identified.
PLC processor and program are located between the input and output
modules.
Prof. Dr.-Ing. Saleh M. Chehade
PLC Solution
Tank Control Field Device Interface
(a) PLC and field device interface for one pump
Prof. Dr.-Ing. Saleh M. Chehade
PLC Ladder Logic
(b) PLC ladder logic
Prof. Dr.-Ing. Saleh M. Chehade
PLC Ladder Logic Operation 1 - 2
Solution has three rungs with input instructions on left—output
instructions on right.
Rungs 00 and 02 have data addresses of I1 and I2, so the voltage at
input terminals 1 and 2 determines if these instruction states are true
(continuity) or false (no continuity).
Input terminal voltages are set by external switches S1 and S2.
Prof. Dr.-Ing. Saleh M. Chehade
PLC Ladder Logic Operation 2 - 2
Input instruction in rung 01 is set by the condition of the virtual relay,
CR1.
The output instructions in rungs 01 and 02 have data addresses of
O1 and O2—their true or false state determines the on and off state
of output devices connected to output terminals 1 and 2.
Prof. Dr.-Ing. Saleh M. Chehade
PLC Ladder Logic/Alternate Solution
The virtual relay, CR1, is
removed and multiple input
instructions with address I1
achieve the same logical
control.
Since the I1 in the ladder logic
is a virtual instruction created
in memory, two I1 instructions
are used so the solution is only
two rungs.
Prof. Dr.-Ing. Saleh M. Chehade
Example 2
The tank control system
illustrated has a second pump
added to drain the tank. This
second pump should be on if the
following conditions are true:
1- The inlet valve is open.
2- Pump 1 is on AND the new
pump 2 selector switch is
closed.
Determine the changes required
in the relay logic solution.
Prof. Dr.-Ing. Saleh M. Chehade
Example 2 / RLL Solution
(a) PLC and field device interface for two pumps
(b) Relay logic solution for two pumps
Prof. Dr.-Ing. Saleh M. Chehade
Example 2 / PLC Ladder Logic Solution
(a) PLC and field device interface for two pumps
(a) PLC ladder logic solution for two pumps
Prof. Dr.-Ing. Saleh M. Chehade
PLC Programming
Prof. Dr.-Ing. Saleh M. Chehade
Typical Low Level Language of the PLC
Command Description
STR Store a new input and start a new rung of the ladder
AND Logical AND referenced with the previously entered element. This is interpreted as a
series circuit relative to the previously entered element
OR Logical OR referenced with the previously entered element. This is interpreted as a
parallel circuit relative to the previously entered element
NOT Logical NOT or inverse of the entered element
OUT Output element for the rung of the ladder diagram
TMR Timer element. Requires one input signal to initiate timing sequence. Output is
delayed relative to input by a duration specified by the programmer in see in
seconds. Resetting the timer is accomplished by interrupting the input signal.
CTR Counter element. Requires two inputs: One is the incoming pulse train that is
counted by the CTR element, the other is the reset signal indicating a restart of the
counting procedure.
Prof. Dr.-Ing. Saleh M. Chehade
Example 3
An industrial robot performs a machine loading and unloading operation. A PLC is used as the
robot cell controller.
- The cell operates as follows:
(1) a human worker places a workpart into a nest,
(2) the robot reaches over and picks up the part and places it into an induction heating coil,
(3) a time of 10 seconds is allowed for the heating operation, and
(4) the robot reaches in and retrieves the part and places it on an outgoing conveyor.
- A limit switch X1 (normally open) will be used in the nest to indicate part presence in step (1).
- Output contact Y1 will be used to signal the robot to execute step (2) of the work cycle.
- This is an output contact for the PLC, but an input interlock for the robot controller.
- Timer T1 will be used to provide the 10 second delay in step (3).
- Output contact Y2 will be used to signal the robot to execute step (4).
Required:
(a) Construct the ladder logic diagram for the system.
(b) Write the low level language statements for the system using the PLC instruction in the
previous slide
Prof. Dr.-Ing. Saleh M. Chehade
Example 3 / Solution
a) Logic Ladder b) Programming
X1 Y1 Low level language statements:
STR X1
OUT Y1
X2 T1
10 s STR X2
TMR T1 10 (10 specifies timer delay in sec)
T1 X3 C1 STR T1
OR C1
AND NOT X3
C1 OUT C1
STR C1
OUT Y2
C1 Y2
Prof. Dr.-Ing. Saleh M. Chehade
Example 4
- A PLC is used to control the sequence in an automatic drilling operation.
a) Variables
- A human operator loads and clamps a raw work-part into a fixture on the X1 = spindle up
drill press table and presses a start button to initiate the automatic cycle. X2 = spindle at desired depth
- The drill spindle turns on, feeds down into the part to a certain depth (the X3 = fixture at position 1
depth is determined by limit switch), and then retracts. X4 = fixture at position 2
- The fixture then indexes to a second drilling position, and the drill X5 = start button
feed-and-retract is repeated. Y1 = spindle on
- After the second drilling operation, the spindle turns off, and the fixture Y2 = spindle down
Y3 = fixture to position 2
moves back to the first position.
C1 = drill cycle permit
- The worker then unloads the finished part and loads another raw part. C2 = hole 1 drilled
C3 = hole 2 drilled.
Required :
(a) Specify the input/output variables for this system operation and define
symbols for them (e.g., X1, X2, C1, Y1, etc.).
(b) Construct the ladder logic diagram for the system.
(c) Write the low level language statements for the system using the PLC
instruction in the previous slide.
Prof. Dr.-Ing. Saleh M. Chehade
Example 3 / Solution
b) Logic Ladder c) Programming
a) Variables C1
STR NOT C3 AND C2
X5 X1 X3 C3
X1 = spindle up OR NOT X1 OUT C3
X2 = spindle at desired depth
X3 = fixture at position 1 C1 X1 OUT C10 (C10 used to facilitate parallel circuit) STR C1
X4 = fixture at position 2 STR X5 OUT Y1
X5 = start button C2
Y2 C1
Y1 = spindle on
X2 X3
AND X1 STR X4
Y2 = spindle down
Y3 = fixture to position 2 C2
AND X3 AND NOT C3
C1 = drill cycle permit OR C1 OUT C11 (C11 used to facilitate parallel circuit)
C2 = hole 1 drilled
C3 = hole 2 drilled. X2 Y2 X4 C2 C3 AND C10 STR X3
OUT C1 AND NOT C2
C3
STR X2 OR C11
C1
Y1 AND Y2 AND C1
AND X3 OUT Y2
X3 C2 C1 Y2 OR C2 STR C2
AND C1 AND X1
X4 C3
OUT C2 OR Y3
Y3
STR X2 AND C1
C2 X1 C1
AND Y2 OUT Y3
Y3
AND X4
OR C3
Prof. Dr.-Ing. Saleh M. Chehade
Personal Computers Using Soft Logic
Available in sturdy enclosures for
plant environment
Membrane-type keyboards to protect
against dirt, moisture, etc.
Can be ordered with I/O cards and
other hardware to connect to
machines and processes
Installed with Windows for
implementing control applications
Can be programmed with soft logic -
software that emulates the
operations of the built-in control
software in PLCs
Prof. Dr.-Ing. Saleh M. Chehade