Uploaded by 0a0z0u0z0

plc-1to6

advertisement
Programmable Logic Controllers and Automation
METR3013
Topic #1
WEEK#1
Introduction
Course Learning Outcomes
Identify the main parts of a PLC system.
Assess the functions of a PLC memory map and it program scan sequence.
Lecturer Name
Academic Year
Course Coordinator Name
: Dr. Clement Karu
: 2020-2021
: Dr. Clement Karu
1
Programmable Logic Controllers(PLCs)
Definition & History of the PLC
A PLC is a user-friendly, microprocessor-based specialized computer that
carries out control functions of many types and levels of complexity. Its
purpose is to monitor crucial process parameters and adjust process
operations accordingly.
• Used extensively because the PLC
– Is easy to set up and program
– Behaves predictably
– Ruggedized
Programmable logic controllers (Figure 1) are now the most widely used
industrial process control technology. A programmable logic controller
(PLC) is an industrial-grade computer that is capable of being programmed
to perform control functions. The programmable controller has eliminated
much of the hardwiring associated with conventional relay control circuits.
Other benefits include easy programming and installation, high control
speed, network compatibility, troubleshooting, and testing convenience, and
high reliability.
Fig 1 Programmable Logic Controller
3
Example PLCs
4
Fig 2. Applications of PLCs
Fig 3. PLC in CNC machine
Courtesy : Maxmill
5
Fig 4. PLCs I Control panel
6
Fig 5. Control program cam be displayed on a monitor
7
Figure 6. All the Logic is contained in the PLCs memory
Figure 7. Input and Output devices to the PLC
8
The programmable logic controller is designed for multiple inputs and
outputs arrangements, extended temperature ranges, immunity to
electrical noise, and resistance to vibration and impact. Programs for the
control and operation of manufacturing process equipment and machinery
are typically stored in battery-backed or nonvolatile memory. A PLC is an
example of a real-time system since the output of the system controlled by
the PLC depends on the input conditions.
The programmable logic controller is, then, basically a digital computer
designed for use in machine control.
PLCs provide many other benefits including:
• Increased Reliability
• More Flexibility.
• Lower Cost.
• Communications Capability.
• Faster Response Time.
• Easier to Troubleshoot.
9
Fig 8. Relay based Control Panel
Fig 9. PLC based Control Panel
10
PLC Advantages
Large Quantities of Contacts
– The PLC has a large number of contacts for each coil
available in its programming.
– Suppose that a panel-wired relay has four contacts and
all are in use when a design change requiring three more
contacts is made.
• Time would have to be taken to procure and install a new
relay or relay contact block.
– Using a PLC, however, only three more contacts would
be typed in.
• Contacts are now a “software” component
PLC Advantages
• Lower Cost
– Increased technology makes it possible to condense
more functions into smaller and less expensive packages.
– Now you can purchase a PLC with numerous relays,
timers, and counters, a sequencer, and other functions for
a few hundred dollars.
• Pilot Running
– A PLC programmed circuit can be evaluated in the lab.
The program can be typed in, tested, observed, and
modified if needed, saving valuable factory time.
PLC Advantages
• Visual Observation
– A PLC circuit's operation can be seen during operation
directly on a CRT screen.
– The operation or mis-operation of a circuit can be
observed as it happens.
– Logic paths light up on the screen as they are energized.
– Troubleshooting can be done more quickly during visual
observation.
PLC Advantages
• Ladder or Boolean Programming Method
– The PLC programming can be accomplished in the ladder
mode by an engineer, electrician or possibly a technician.
Alternatively, a PLC programmer who works in digital or Boolean
control systems can also easily perform PLC programming.
• Reliability and Maintainability
– Solid-state devices are more reliable, in general, than
mechanical systems or relays and timers. Consequently, the
control system maintenance costs are low and downtime is
minimal.
2. Parts of a PLC
A typical PLC can be divided into parts, as illustrated in Figure 10. These
are the
a)Central Processing Unit (CPU),
b)Input/output (I/O) section/devices,
c)Power supply, and
d)Programming device.
The term architecture can refer to PLC hardware, to PLC software, or to a
combination of both.
a) An open architecture
b) Closed architecture
There are two ways in which I/Os (Inputs/Outputs) are incorporated into the
PLC: Fixed and Modular
15
16
Figure 10
Modular I/O is divided by compartments into which separate modules can be
plugged. This feature greatly increases your options and the unit’s flexibility. You
can choose from the modules available from the manufacturer and mix them any
way you desire. The basic modular controller consists of a rack, power supply,
processor module (CPU), input/output (I/O modules), and an operator interface
for programming and monitoring. The modules plug into a rack. When a module is
slid into the rack, it makes an electrical connection with a series of contacts called
the backplane, located at the rear of the rack. The PLC processor is also
connected to the backplane and can communicate with all the modules in the
rack.
Fixed I/O is typical of small PLCs that come in one package with no separate,
removable units. The processor and I/O are packaged together, and the I/O
terminals will have a fixed number of connections built in for inputs and outputs.
The main advantage of this type of packaging is lower cost. The number of
available I/O points varies and usually can be expanded by buying additional
units of fixed I/O. One disadvantage of fixed I/O is its lack of flexibility; you are
limited in what you can get in the quantities and types dictated by the packaging.
Also, for some models, if any part in the unit fails, the whole unit has to be
replaced.
17
Fig 11. I/P and O/P modules
Fig 12. Modular I/O configuration
Fig 13. Typical PLC Scan modules
18
Fig 15. Complete PLC connected to I/O and O/P devices
Fig 16. Fixed I/O
19
The Processor (CPU) is the “brain” of the PLC. A typical processor (Figure 17)
usually consists of a microprocessor for implementing the logic and controlling the
communications among the modules. The processor requires memory for storing
the results of the logical operations performed by the microprocessor. Memory is
also required for the program EPROM or EEPROM plus RAM. The CPU controls
all PLC activity and is designed so that the user can enter the desired program in
relay ladder logic. The PLC program is executed as part of a repetitive process
referred to as a scan. A typical PLC scan starts with the CPU reading the status of
inputs. Then, the application program is executed. Once the program execution is
completed, the CPU performs internal diagnostic and communication tasks. Next,
the status of all outputs is updated. This process is repeated continuously as long
as the PLC is in the run mode.
20
Fig 17. Typical PLC processor modules
The I/O system forms the interface by which field devices are connected to the
controller (Figure 18). The purpose of this interface is to condition the various
signals received from or sent to external field devices. Input devices such as
pushbuttons, limit switches, and sensors are hardwired to the input terminals.
Output devices such as small motors, motor starters, solenoid valves, and indicator
lights are hardwired to the output terminals.. The external devices are also referred
to as “field” or “real-world” inputs and outputs. The terms field or real world are used
to distinguish actual external devices that exist and must be physically wired from
the internal user program that duplicates the function of relays, timers, and counters.
21
Fig 18. I/O system
A programming device is used to enter the desired program into the memory
of the processor. The program can be entered using relay ladder logic, which is
one of the most popular programming languages. Instead of words, ladder logic
programming language uses graphic symbols that show their intended outcome.
A program in ladder logic is similar to a schematic for a relay control circuit. It is a
special language written to make it easy for people familiar with relay logic
control to program the PLC. Hand-held programming devices ( Figure 19) are
sometimes used to program small PLCs because they are inexpensive and easy
to use. Once plugged into the PLC, they can be used to enter and monitor
programs. Both compact hand-held units and laptop computers are frequently
used on the factory floor for troubleshooting equipment, modifying programs, and
transferring programs to multiple machines.
A personal computer (PC) is the most commonly used programming device.
The personal computer communicates with the PLC processor via a serial or
parallel data communications link, or Ethernet.
Fig 19
22
A program is a user-developed series of instructions that directs the PLC to
execute actions. A programming language provides rules for combining the
instructions so that they produce the desired actions. Relay ladder logic (RLL)
is the standard programming language used
with PLCs. Its origin is based on electromechanical relay control. The relay
ladder logic program graphically represents rungs of contacts, coils, and special
instruction blocks. RLL was originally designed for easy use and understanding
for its users and has been modified to keep up with the increasing demands of
industry’s control needs.
23
Fig 20.
Principles Of Operation
18
Principles Of Operation
A programmable controller, as illustrated below,
consists of two basic sections:
• The central processing unit
• The input/output interface system
19
Principles Of Operation
The central processing unit (CPU) governs all
PLC activities. The following three components,
shown below, form the CPU:
• The processor
• The memory system
• The system power supply
20
Principles Of Operation
• The operation of a PLC is simple. The input/output (I/O)
system is physically connected to the field devices that
are encountered in the machine or that are used in the
control of a process.
• These field devices may be discrete or analog
input/output devices, such as limit switches, push
buttons, motor starters, solenoids, etc. The I/O
interfaces provide the connection between the CPU and
the information providers (inputs) and controllable
devices (outputs).
21
Principles Of Operation
During its operation, the CPU completes three
processes:
(1) it reads the input data from the field devices via
the input interfaces,
(2) it executes the control program stored in the
memory system, and
(3)it writes the
interfaces.
output
devices
via
the
output
This process of sequentially reading the inputs,
executing the program in memory, and updating the
outputs is known as scanning.
22
PRINCIPLES OF OPERATION
The input/output system forms the interface by which
field devices are connected to the controller. The
system power supply provides all the voltages
required for the proper operation of the various central
processing unit sections.
23
PRINCIPLES OF OPERATION
Example
Here a mixer motor is to be
used to automatically stir the
liquid in a vat when the
temperature and pressure
reach preset values. In
addition,
direct
manual
operation of the motor is
provided by means of a
separate pushbutton station.
The process is monitored with temperature and
pressure sensor switches that close their respective
contacts when conditions reach their preset values.24
Hardware Implementation
Typical wiring connections for a 120 VAC
modular configured input module
25
PLC Implementation
A typical ladder logic program for this process is shown
26
Programmable Logic Controllers and
Automation
METR3013
Topic 1: Introduction to PLC
Week 2: Basic Laws of Boolean Algebra .
Course Learning Outcomes (CLO)
On successful completion of this course you will be able to:
• Identify the main parts of a PLC system.
• Construct relay ladder schematics by using Boolean expression.
Lecturer Name: Dr. Clement Karu
Academic Year: 2021- 2022
Course Coordinator Name: Dr. Clement Karu
PLC Implementation
• The PLC ladder logic program would be
constructed and entered into the memory of
the CPU.
• The format used is similar to the layout of the
hardwired relay ladder circuit. The individual
symbols represent instructions, whereas the
numbers represent the instruction location
addresses.
2
Ladder Diagrams And The Plc
The ladder diagram has a traditional way of representing
electrical sequences of operations. These diagrams
represent the interconnection of field devices in such a way
that the activation, or turning ON, of one device will turn ON
another device according to a predetermined sequence of
events. Figure below illustrates a simple electrical ladder
diagram.
3
Ladder diagrams and the plc
The following figure illustrates the PLC transformation of the
simple diagram shown in the previous slide to a PLC format.
Note that the “real” I/O field devices are connected to input
and output interfaces, while the ladder program is
implemented in a manner, similar to hardwiring, inside the
programmable controller.
4
Example 1
In the hardwired circuit shown, the pilot light PL will
turn ON if the limit switch LS1 closes and if either
push button PB1 or limit switch LS2 closes. In the
PLC circuit, the same series of events will cause the
pilot light, connected to an
output module, to turn ON.
Sketch hardwired and PLC
implementation diagrams for
the circuit illustrating the
configurations of inputs that will
turn PL ON.
5
Solution
6
Solution
7
Solution
8
Hardwired and PLC Representations
9
Exercise & Solution
10
Number Systems And Codes
Decimal System
The radix or base of a number system determines
the total number of different symbols or digits
used by the system.
The decimal system has a base of 10.
In the decimal system, 10 unique numbers or
digits ( 0 through 9) are used: the total number
of symbols is the same as the base, and the symbol
with the largest value is 1 less than the base.
Decimal System
The decimal system can be summarized as follows:
Ten digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
Base: 10
Weights:
1, 10, 100, 1000, …(powers of base 10)
Decimal System
Weighted value in the decimal system
Binary System
The binary system has a base of 2.
The only allowable digits are 0 and 1
Digital Signal Waveform: with digital circuits it is easy
to distinguish between two voltage levels - +5 V and O V,
which can be related to the binary digits 1 and 0.
Volts
High (H) (1)
+5
Low (L) (0)
0
Time
Binary System
The binary system can be summarized as follows:
Two digits: 0, 1
Base: 2
Weights:
1, 2, 4, 8, 16, 32, …(powers of base 2)
Binary System
Since the binary system uses only
two digits, each position of a binary
number can go through only two
changes, and then a 1 is carried to
the immediate left position.
To express the number in the
binary system requires many
more digits than in the decimal
system.
Decimal
Binary
0
0000
1
0001
2
0010
3
4
5
0011
0100
0101
6
0110
7
8
0111
1000
Converting For Binary To Decimal
Converting For Binary To Decimal
Another Method
In the binary number
when you see a 1, multiply
that 1 times the value that
is directly over it. Where
you see a 0 in the box,
just ignore it.
128
64
32 16
8
4
2
1
If we add only those numbers which have a binary 1
in the box under them, we come up with
128+32+8+4+1 which equals 173.
Bits – Bytes - Words
Each digit of a binary number is known as a bit.
A group of 8 bits is known as a byte.
A group of bits that occupies one or more storage
locations and is treated as a unit is known as a word.
A 16-bit word is made up of two bytes (Upper and Lower).
The least significant bit (LSB) is the digit that represents
the smallest value.
The most significant bit (MSB) is the digit that represents
the largest value.
16-Bit Word
MSB
Bit
Upper Byte
LSB
PLC Processor Memory Size
The size of the programmable controller relates to the
amount of user program that can be stored.
The 1 K word memory
size shown can store
1,024 words, or 16,380
(1,024 x 16) bits of
information using
16-bit words or 32,768
(1,024 x 32) using
32 bit words.
Converting For Decimal To Binary
Binary Representation Of Data
Even though the binary system has only two digits,
it can be used to represent any quantity that can be
represented in the decimal system. Computer memory
is then a series of binary 1s and 0s.
SLC 500 Modular Chassis Output Status File
Made up of single bits grouped into 16-bit words
One 16-bit output file word is reserved for each slot
in the chassis.
Each bit represents the “on” or “off” state of one
output point. These points are numbered 0 through15.
The column on the right lists the output module address.
A word will be created in the table only if the processor
finds an output module residing in a particular slot.
Negative Numbers
In the binary system it is not possible to use positive
and negative symbols to represent the polarity of a
number.
One method is of representing a binary number as
either a positive or negative value is to use an extra digit,
or sign bit, at the MSB of the number. In the sign bit
position, a “0” indicates that the number is positive,
and a “1” indicates a negative number.
Sign
Sign
Bit
Bit Magnitude
Bits
Magnitude
Bits
Decimal
Decimal
Value
Value
Negative Numbers
Another method of expressing a negative number in a
digital system is by using the complement of a binary
number. To represent a negative number in 1's
complement you simply take the numbers magnitude
and flip all the bits (i.e. 1 becomes 0, and 0 becomes 1).
+3 binary representation: 0011
-3 binary representation: 1100 (1’s complement)
Negative Numbers
The most common way to express a negative binary
number is to show it as a 2’s complement number. The
2’s complement is the binary number that results
when 1 is added to the 1’s complement.
+3 binary representation: 0011
-3 binary representation: 1100 (1’s complement)
-3 binary representation: 1101 (2’s complement)
Octal System
The octal numbering system can be summarized
as follows:
Eight digits: 0, 1, 2, 3, 4, 5, 6, 7
Base: 8
Weights:
1, 8, 64, 512, …(powers of base 8)
The octal number system is sometimes used
because 8 data bits make up a byte of information
that can be easily addressed by the PLC user or
programmer.
Octal System
The Allen-Bradley PLC-5 family of PLCs uses
the octal numbering systems for addressing
of I/O modules.
I:2/16
O:3/22
Octal System
The digits range from 0 to 7; therefore, numbers
8 and 9 are not allowed!
Converting Octal To Decimal
As in all other numbering system, each digit in an
octal number has a weighted decimal value
according to its position.
Converting Octal-to-Binary
Octal is used to handle large binary numbers. One octal
digit is used to express three binary digits.
Hexadecimal System
The hexadecimal (hex) numbering system can
be summarized as follows:
Sixteen digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
Base: 16
Weights:
1, 16, 256, …(powers of base 16)
The hex numbering system is used in PLCs because
a word of data often consists of 16 data bits, or
two 8-bit bytes.
Hexadecimal-to-Decimal Conversion
To convert a hexadecimal number to its decimal
equivalent, the hexadecimal digits in the columns are
multiplied by the base 16 weight.
Hexadecimal-to-Binary Conversion
Using the hex numbering system allows the status
of a large number of binary bits to be represented
in a small space such as a PLC programming display.
BCD (Binary-Coded Decimal) System
The BCD (Binary-Coded Decimal) numbering system
provides a convenient way of handling large numbers
that need to be inputted to or outputted from a PLC.
There is no easy way to go from binary to decimal
and back. The BCD system provides a means of
converting a code readily handled by humans (decimal)
to a code readily handled by equipment (binary).
Examples Of Numeric
Values In:
Decimal,
Binary,
BCD,
and Hexadecimal,
Representation
BCD Representation Of Decimal Number
Conversion from Decimal to BCD is straightforward.
You merely use 4 bits to represent each decimal digit.
BCD Thumb-Wheel Switch Interface
The circuit board
has one connection
for each bit’s
weight plus a
common
The thumb-wheel
switch outputs the
equivalent 4-bits
of BCD data
A decimal number
is selected
Programmable Logic Controllers and
Automation
METR3013
Tpoic 1: Introduction to PLC
Week 3: Input/Output Module.
Course Learning Outcomes (CLO)
On successful completion of this course you will be able to:
• Identify the main parts of a PLC system.
• Construct relay ladder schematics by using Boolean expression.
Lecturer Name: Dr. Clement Karu
Younis Academic Year: 2021-2022
Course Coordinator Name: Dr. Clement Karu
Boolean Logic Design
The process of converting control objectives into a ladder
logic program requires structured thought. Boolean
algebra provides the tools needed to analyze and design
these systems.
The techniques can model a logical system with a
single equation. The equation can then be simplified
and/or manipulated into new forms. The same
techniques developed for circuit designers adapt very
well to ladder logic programming.
2
The three basic operators are AND, OR and NOT; more
complex operators include exclusive or (EOR), not and
(NAND), not or (NOR).
• The three basic operators are AND, OR and
NOT;
A
Y
B
AND
A
B
Y
OR
A
Y
NOT
3
• more complex operators include exclusive or
(EOR), not and (NAND), not or (NOR).
EOR
NAND
NOR
Describing Circuit Functionality:
Inverter
A
Truth Table
Y
A
Y
0
1
1
0
Symbol
Input
•
Basic logic functions have symbols.
•
The same functionality can be represented with truth tables.
– Truth table completely specifies outputs for all input
combinations.
•
The above circuit is an inverter.
– An input of 0 is inverted to a 1.
– An input of 1 is inverted to a 0.
NOT Ladder Logic
Output
The AND Gate
• This is an AND gate.
• If the two inputs signals
are asserted (high) the
output will also be asserted.
Otherwise, the output will
be disserted (low).
AND Ladder Logic
A
Y
B
Truth Table
A
B
Y
0
0
0
0
1
0
1
0
0
1
1
1
The OR Gate
• This is an OR gate.
• If either of the two
input signals are
asserted, or both of
them are, the output
will be asserted.
OR Ladder Logic
A
B
Y
A
B
Y
0
0
0
0
1
1
1
0
1
1
1
1
Describing Circuit Functionality: Waveforms
AND Gate
•
•
•
A
B
Y
0
0
0
0
1
0
1
0
0
1
1
1
Waveforms provide another approach for representing
functionality.
Values are either high (logic 1) or low (logic 0).
Can you create a truth table from the waveforms?
NAND Gate
9
NOR Gate
10
XOR Gate
11
Ordering Boolean Functions
• How to interpret AB+C?
– Is it AB ORed with C ?
– Is it AANDed with B+C ?
• Order of precedence for Boolean algebra: AND
before OR.
• Note that parentheses () are needed here :
Boolean Functions
• Boolean algebra deals with binary variables and logic
operations.
• Function results in binary 0 or 1
x
0
0
0
0
1
1
1
1
y
0
0
1
1
0
0
1
1
z
0
1
0
1
0
1
0
1
F
0
0
0
0
1
0
1
1
x
y
z
z’
y+z’
F = x(y+z’)
F = x(y+z’)
• F = x(yx+z’)
• F = x(y+z’) +yz
Boolean Functions
• Boolean algebra deals with binary variables and logic
operations.
• Function results in binary 0 or 1
x
0
0
0
0
1
1
1
1
y
0
0
1
1
0
0
1
1
z
0
1
0
1
0
1
0
1
xy
0
0
0
0
0
0
1
1
yz
0
0
0
1
0
0
0
1
G
0
0
0
1
0
0
1
1
x
xy
y
G = xy +yz
z
yz
We will learn how to transition between equation,
symbols, and truth table.
Truth Table to Expression
• Converting a truth table to an expression
– Each row with output of 1 becomes a product term
– Sum product terms together.
x
0
0
0
0
1
1
1
1
y
0
0
1
1
0
0
1
1
z
0
1
0
1
0
1
0
1
G
0
0
0
1
0
0
1
1
Any Boolean Expression can be
represented in sum of products form!
xyz + xyz’ + x’yz
Equivalent Representations of Circuits
•
•
All three formats are equivalent
Number of 1’s in truth table output column equals AND
terms for Sum-of-Products (SOP)
x
0
0
0
0
1
1
1
1
y
0
0
1
1
0
0
1
1
z
0
1
0
1
0
1
0
1
G
0
0
0
1
0
0
1
1
G = xyz + xyz’ + x’yz
x
x
x
x
x
x
x
G
x
x
x
y
z
Basic Laws of Boolean Algebra
18
Reducing Boolean Expressions
• Is this the smallest possible implementation of this expression?
G = xyz + xyz’ + x’yz
No!
• Use Boolean Algebra rules to reduce complexity while preserving
functionality.
• Step 1: Use Theorem 1 (a + a = a)
xyz + xyz’ + x’yz = xyz + xyz + xyz’ + x’yz
• Step 2: Use distributive rule a(b + c) = ab + ac
xyz + xyz + xyz’ + x’yz = xy(z + z’) + yz(x + x’)
• Step 3: Use Postulate 3 (a + a’ = 1)
xy(z + z’) + yz(x + x’) = xy.1 + yz.1
• Step 4: Use Postulate 2 (a . 1 = a)
xy.1 + yz.1 = xy + yz = xyz + xyz’ + x’yz
Reduced Hardware Implementation
• Reduced equation requires less hardware!
• Same function implemented!
G = xyz + xyz’ + x’yz = xy + yz
Example:
simplify the following expression
𝐹 = 𝐴ҧ. 𝐵. 𝐶 +
𝐴. 𝐵ത. 𝐶
𝐵. 𝐶ҧ+
𝐴. 𝐵. 𝐶
+ 𝐴.
Example
• Two limit switches connected in series with each
other and in parallel with two other limit
switches (that are connected in series with each
other), and used to control a pilot light.
22
Example
One limit switch connected in series with a normally
closed pushbutton and used to control a solenoid
valve. This circuit is programmed so that the output
solenoid will be turned on when the limit switch is
closed and the pushbutton is not pushed.
23
• Process Description:
A heating oven with two bays can heat one ingot in each
bay. When the heater is on it provides enough heat for two
ingots. But, if only one ingot is present the oven may
become too hot, so a fan is used to cool the oven when it
passes a set temperature.
24
Control Description:
If the temperature is too high and there is an ingot in only
one bay then turn on fan.
Define Inputs and Outputs:
B1 = bay 1 ingot present
B2 = bay 2 ingot present
F = fan
T = temperature overheat sensor
26
Programmable Logic Controllers and Automation
METR3013
Topic 2: PLC Program Files and ladder
diagram
Week 1: Ladder Diagrams/
Memory Organization.
Course Learning Outcomes (CLO)
On successful completion of this course you will be able to:
• Construct relay ladder schematics by using Boolean expression.
• Asses the functions of a PLC memory map and its program scan sequence.
Lecturer Name: Dr. Clement Karu
Academic Year: 2021-2022
Course Coordinator Name: Dr. Clement Karu
Delivery Plan
Topic 2 : PLC Program Files and ladder diagram
Week -1: Memory Organization
Week -2: Ladder Diagrams and PLC
Internal Relays
Week -3: Timer in plc and their
instruction
2
Memory Organization
•
•
The memory
organizations of the
rack-based AllenBradley PLC-5 and
SLC 500 controllers
are very similar.
The Figure shows the
program and data file
organization for the
SLC 500 controller.
The contents of each
file are as follows.
3
Program Files
Program files are the areas of processor memory where
ladder logic programming is stored.
Program files are the part of the
processor memory that stores the user
ladder logic program. The program
accounts for most of the total memory
of a given PLC system.
4
Data Files
The Data file portion of the processor’s memory stores
input and output status, processor status, the status of
various bits, and numerical data. These files are organized
by the type of data they contain
5
Memory Words and Word Locations
• Binary signals have only two states
– O N or O F F
– 1 or 0
– High or low
• Bit: binary digit
• Binary words can be 32, 16, or 8 bits in
length
6
Memory Words and Word Locations
• Byte: group of 8 bits
• Address: memory storage location
• Addressing scheme also identifies hardware
location Rack, module, terminal number
7
Memory
organization for a
PLC-5 controller.
The PLC-5 and SLC 500 store all data in global
data tables and are based on 16-bit operations.
You access these data by specifying the address
of the data you want.
The addresses in the output data file and the input
data file are potential locations for I/O modules
mounted in the chassis.
•
The status data file
contains information
about the processor
status
• The bit data file stores
bit status and
frequently serves for
storage when using
internal outputs.
• The timer file stores the timer status and
timer data.
• The counter file stores the counter status
and counter data.
I/O address format for the SLC family of PLCs.
12
Input image table file
• The input image table file is
that part of the program
memory allocated to storing
the on/off status of connected
discrete inputs.
open switch to the input
image table file
closed switch to the input
image table file
13
Output image table file
The output image table file
is that part of the program
memory allocated to storing
the actual on/off status of
connected discrete outputs.
The Figure shows a typical connection of two pilot lights to
the output image table file through the output module.
14
Typically, micro PLCs have a fixed number of
inputs and outputs.
This controller has 20 discrete inputs with addresses I/0 through
I/19 and 12 discrete outputs with addresses O/1 through O/11.
Program Scan
program scan cycle
When a PLC executes a program, it must know—in
real time—when external devices controlling a process
are changing.
During each operating cycle, the processor reads all the
inputs, takes these values, and energizes or de-energizes
the outputs according to the user program. This process is
known as a program scan cycle.
Because the inputs can change at any time, it constantly
repeats this cycle as long as the PLC is in the RUN
mode.
16
Program Scan (Cont.)
program scan cycle
17
Program Scan (Cont.)
Scan time
The scan time is a function of the following:
• The speed of the processor module
• The length of the ladder program
• The type of instructions executed
• The actual ladder true/false conditions
18
Program Scan (Cont.)
The Figure illustrates the scan process applied to a simple
single rung program. The operation of the scan process can
be summarized as follows:
If the input device connected to address I:3/6 is closed, the
input module circuitry senses electrical continuity and a 1
(ON) condition is entered into the input image table bit I:3/6.
19
Program Scan (Cont.)
During the program scan, the processor examines bit
I:3/6 for a 1 (ON) condition.
In this case, because input I:3/6 is 1, the rung is said to
be TRUE or have logic continuity.
20
• The processor then sets the output image table
bit O:4/7 to 1.
• The processor turns on output O:4/7 during the
next I/O scan, and the output device (light) wired
to this terminal becomes energized.
• This process is repeated as long as the
processor is the RUN mode.
PLC Programming Languages
PLC programming language refers to the method
by which the user communicates information to
the PLC.
Standard PLC programming languages
22
• Ladder diagram language is the most commonly used
PLC language and is designed to mimic hardwired relay
logic.
Hardwired relay
control circuit
Equivalent instruction
list program
Input/Output Module Units
• The input/output unit of PLCs handles the job of
interfacing high power industrial devices to the
low-power electronic circuitry that stores and
executes the control program.
• Most PLCs operate internally at between 5 and
15V d.c, signal from input devices can be much
greater, typically 24V d.c. to 240V a.c. at
several amperes.
24
Input/Output Module Units (Cont.)
• The I/O module units form the interface between
the microelectronics of the programmable
controller and the real world outside, and must
therefore provide all necessary signal conditioning
and isolation functions. This often allows a PLC to
be directly connected to process actuators and
input devices without the need for intermediate
circuitry or relays.
25
Input/Output Module Units (Cont.)
• To provide this signal conversion, programmable
controllers are available with a choice of input/output
units to suit different requirements. For example:
It is standard practice for all I/O channels to be electrically
isolated from the controlled process, using opto-isolator
circuits on the I/O modules.
26
Input/Output Module Units (Cont.)
PLC’s input module connection
27
Input/Output Module Units (Cont.)
PLC’s output module connection
28
Selection of a Programmable Logic
Controller
To determine the most suitable PLC to be used in
the automation task, there are several basic
considerations to be made
➢ Necessary input/output capacity;
➢ Types of I/O required;
➢ size of memory required;
➢
Speed and power required of the CPU and
instruction set.
➢ Manufacturer's support and backup.
29
Memory Organization
➢ Storage memory
▪ E n tire storage m emory called data table or
register table
▪ Data can be stored in a variety of numbering
systems
➢ User memory
▪ Holding registers store tem porary data
needed by the processor
30
Instruction Addressing
• To complete the entry of a relay-type instruction, you
must assign an address to each instruction.
Address indicates
what input is
connected to what
input device
Address indicates
what output is
connected to what
output device
• The assignment of an I/O address can be included in
the I/O connection diagram.
Inputs and outputs are typically represented by
squares and diamonds, respectively.
Internal Relay Instructions
An internal output does not directly control an output field
device.
The advantage of using internal outputs is that there are many
situations in which an output instruction is required in a program
but no physical connection to a field device is needed.
• SLC 500 controllers use bit file B3 for internal
bit addressing.
• Internal relay used for a program that requires more
series contacts than the rung allows.
• This PLC allows for only 7 series contacts when 12 are
actually required for the programmed logic.
Programmable Logic Controllers and Automation
METR3013
Topic 2: PLC Program Files and ladder
diagram
Week 5: PLC Internal Relays
Course Learning Outcomes (CLO)
On successful completion of this course you will be able to:
• Construct relay ladder schematics by using Boolean expression.
• Asses the functions of a PLC memory map and its program scan sequence.
Lecturer Name: Dr. Clement Karu
Younis Academic Year: 2021-2022
Course Coordinator Name: Dr. Clement Karu
PLC Inputs and outputs
Electromagnetic Control Relays
• An electrical relay is a magnetic switch. It uses
electromagnetism to switch contacts. A relay
will usually have only one coil but may have
any number of different contacts.
2
• A typical control relay used to control two
pilot lights is shown below
3
Contactors
• A contactor is a special type of relay designed
to handle heavy power loads that are beyond
the capability of control relays.
• The programmable
controller is designed
to replace the
physically small control
relays that make logic
decisions but are not
designed to handle
heavy current or high
voltage
4
Motor Starters
• A motor starter is designed to
provide power to motors. The motor
starter is made up of a contactor
with an overload relay attached
physically and electrically to it
Contactor
Overload
relay
5
Manually Operated Switches
• Commonly used types of pushbutton switches
• Mechanically Operated Switches
6
Sensors
Sensors are used for detecting, and often measuring,
the magnitude of something. They convert
mechanical, magnetic, thermal, optical, and chemical
variations into electric voltages and currents. Sensors
are usually categorized by what they measure, and
they play an important role in modern manufacturing
process control
7
Output Control Devices
A variety of output control devices
can be by the PLC output to control
the industrial processes. These
devices include pilot lights, control
relays, motor starters, alarms,
heaters, solenoids, solenoid valves,
small motors, and horns. Similar
electrical symbols are used to
represent these devices both on
relay schematics and PLC output
connection diagrams.
8
An actuator
An actuator, in the electrical sense, is any device that
converts an electrical signal into mechanical
movement. An electromechanical solenoid is an
actuator that uses electrical energy to magnetically
cause mechanical control action.
Solenoid construction
and operation.
Source: Photos
courtesy Guardian
Electric
9
Solenoid valve
construction and
operation. Source: Photo
courtesy ASCO Valve Inc.,
Stepper motor/drive
unit. Source: Photos
courtesy Oriental Motor
10
Latching Relays
The latch coil is
momentarily
energized to set
the latch and hold
the relay in the
latched position.
11
Ladder Diagram Rules
• Read like a book
– Left to right, top to bottom
• Vertical power lines represent voltage
potential
• Devices shown in order of importance
• Electrical devices shown in their normal
condition
12
Ladder Diagram Rules (Cont.)
• Contacts have same number or letter
designation as controlling device
• Contacts change position when the device is
energized
• STOP function devices normally wired in series
• START function devices normally wired in
parallel
13
Converting Relay Schematics into PLC
Ladder Programs
Most control processes require the completion
of several operations to produce the required
output
14
A sequential control process the operations to be
performed in a specific order.
Example:
bottle filling process. In the filling and capping
operations, the tasks are
(1) fill bottle and
(2) press on cap.
These tasks must be performed in the proper order.
15
• Combination controls require that certain
operations be performed without regard to the
order in which they are performed.
Example illustrates another part of the same bottle
filling process. Here, the tasks are
(1) place label 1 on bottle and
(2) place label 2 on bottle.
16
• Automatic control involves maintaining a
desired set point at an output.
One example is maintaining a certain set-point
temperature in a furnace.
This requires feedback from the output to the control
for the input.
17
Sequential process
A relay schematic for the sequential process
18
Sequential process PLC ladder logic program
19
EXAMPLE
• The Figure shows the
sketch of a continuous
filling operation. This
process requires that
boxes moving on a
conveyor be
automatically
positioned and filled.
The sequence of
operation for the
continuous filling
operation is as follows:
20
EXAMPLE (cont.)
• Start the conveyor when the start button is momentarily
pressed.
• Stop the conveyor when the stop button is momentarily
pressed.
• Energize the run status light when the process is operating.
• Energize the standby status light when the process is
stopped.
• Stop the conveyor when the right edge of the box is first
sensed by the photosensor.
• With the box in position and the conveyor stopped, open
the solenoid valve and allow the box to fi ll. Filling should
stop when the level sensor goes true.
• Energize the full light when the box is full. The full light
should remain energized until the box is moved clear of the
photosensor.
21
Answer
22
Programmable Logic Controllers and Automation
METR3013
Topic 2: PLC Program Files and ladder
diagram
Week 3: Timer in plc and their instruction .
Course Learning Outcomes (CLO)
On successful completion of this course you will be able to:
• Construct relay ladder schematics by using Boolean expression.
• Asses the functions of a PLC memory map and its program scan sequence.
Lecturer Name: Dr. Clement Karu
Younis Academic Year: 2021-2022
Course Coordinator Name: Dr. Clement Karu
Internal Relays
• In PLCs there are elements that are used to
hold data, that is, bits, and behave like
relays, being able to be switched on or off
and to switch other devices on or off. Such
an internal relays do not exist as real-world
switching devices but are merely bits in the
storage memory that behave in the same
way as relays.
2
Internal Relays (cont.)
• As shown in the figure
Inputs to external inputs activate the internal
relay output.
• On a later rung of the program:
As a consequence of the internal relay output,
internal relay contacts are activated and so
control some output.
3
Internal Relays (cont.)
• a ladder program for such a task. For the first rung,
when input In 1 or input In 3 is closed and input In 2
closed, internal relay IR 1 is activated. This results in the
contacts for IR 1 closing. If input In 4 is then activated,
there is an output from output Out 1.
Such a task might be
involved in the automatic
lifting of a barrier when
someone approaches
from either side.
4
One-Shot Operation
• One of the functions provided by some PLC
manufacturers is the ability to program an internal
relay so that its contacts are activated for just one
cycle, that is, one scan through the ladder
program. Hence when operated, the internal relay
provides a fixed duration pulse at its contacts.
This function is often termed one-shot.
5
(a) program,
(b) facility in an Allen-Bradley PLC
6
Set and Reset
• The set instruction causes the relay to self-hold, that
is, latch. It then remains in that condition until the
reset instruction is received. The term flip-flop is
often used.
• The RESET coil is reset to the off state when power is
supplied to it and remains off until it is SET.
7
Set and Reset (cont.)
• With an Allen-Bradley PLC, the terms latch
and unlatch are used
8
Set and Reset (cont.)
• Example : fire alarm system. Fire sensors provide
inputs to a SET/RESET function block so that if one
of the sensors is activated,
the alarm is set and
remains set until it is
cleared by being
reset. When set it
sets off the alarm.
fire alarm system
9
Set and Reset (cont.)
• Example: detect when a workpiece has been
loaded into the correct position for some
further operation.
• When the start contacts
are closed, the output
causes the workpiece to
move. This continues
until a light beam is
interrupted and resets,
causing the output to
cease.
workpiece loading
10
Jump and Call
• A function often provided with PLCs is the
conditional jump. We can describe this as:
IF (some condition occurs) THEN perform some
instructions
ELSE perform some other instructions
• The jump takes place from the jump instruction
(JMP) to the label instruction (LBL). The JMP
instruction is given a three-digit number from 000
to 255 and the LBL instruction the same number
11
Example, we might need to design a system so that if the
temperature is above 60C a fan is switched on, and if
below that temperature no action occurs.
Jump
Jump: an Allen-Bradley program
12
Subroutines
• Subroutines are small programs to perform
specific tasks that can be called for use in larger
programs.
• With Allen-Bradley, subroutines are called by using
a jump-to-subroutine (JSR) instruction, the start of
the subroutine being indicated by SBR and its end
and point of return to the main program by RET
13
Example
When input 1 occurs,
the subroutine P is
called. This is then
executed, them
instruction SRET
indicating its end and
the point at which the
program returns to the
main program.
14
Timer in PLC
• In many control tasks there is a need to
control time. For example, a motor or a pump
might need to be controlled to operate for a
particular interval of time or perhaps be
switched on after some time interval.
15
Advantages of PLC timers
PLC timers are instructions that provide the same functions
as on-delay and off-delay mechanical and electronic timing
relays. PLC timers offer several advantages over their
mechanical and electronic counterparts.
These include the fact that:
• Time settings can be easily changed.
• The number of them used in a circuit can be increased or
decreased through the use of programming changes
rather than wiring changes.
• Timer accuracy and repeatability are extremely high
because its time delays are generated in the PLC
processor
16
Timer Instructions
• In general, there are three different PLC timer
types: the on-delay timer (TON), off-delay timer
(TOF), and retentive timer on (RTO). The most
common is the on-delay timer, which is the basic
function.
17
The timer commands can be summarized as follows:
➢
TON (Timer On Delay) —Counts time-based
intervals when the instruction is true.
➢
TOF (Timer Off Delay) —Counts time-based
intervals when the instruction is false.
➢ RTO (Retentive Timer On) —Counts time-based
intervals when the instruction is true and retains the
accumulated value when the instruction goes false or
when power cycle occurs.
➢ RES (Reset) —Resets a retentive timer’s
accumulated value to zero.
18
Quantities associated with the timer
instruction
• The preset time represents the time duration
for the timing circuit. For example, if a time
delay of 10 s is required, the timer will have a
preset of 10 s.
• The accumulated time represents the amount
of time that has elapsed from the moment the
timing coil became energized.
19
Quantities associated with the timer
instruction (cont.)
Time bases of the timer. Timers can be
programmed with several different time bases: 1
s, 0.1 s, and 0.01 s are typical time bases. If a
programmer entered 0.1 for the time base and
50 for the number of delay increments, the timer
would have a 5-s delay (50 × 0.1 s = 5 s). The
smaller the time base selected, the better the
accuracy of the timer.
20
Timer instruction
• Its operation can be summarized as follows:
• The timer is assigned an address and is identified as
a timer.
• Also included as part of the timer instruction is the
time base of the timer, the timer’s preset value or
time-delay period, and the accumulated value or
current time-delay period for the timer
21
Timer instruction (cont.)
• When the timer rung has logic continuity, the timer
begins counting time-based intervals and times until the
accumulated value equals the preset value.
• When the accumulated time equals the preset time, the
output is energized and the timed output contact
associated with the output is closed. The timed contact
can be used as many times as you wish throughout the
program as an NO or NC contact.
22
On-Delay Timer Instruction
• An on-delay timer is used when you want to
program a time delay before an instruction
becomes true
23
On-delay timer example
on-delay timer that uses an NCTO contact. This
circuit is used as a warning signal when moving
equipment, such as a conveyor motor, is about to be
started.
The operation of the circuit can be summarized as
follows:
24
On-delay timer example (cont.)
Enable (EN) bit
true (has a status
of 1) whenever the timer
instruction is true
Done (DN) bit
changes state whenever
the accumulated value
reaches the preset value.
25
On-delay timer example (cont.)
• CR is energized when the start pushbutton PB1 is
momentarily actuated.
• As a result, contact CR-1 latches, and CR-2 closes
to energize timer coil TD, and contact CR-3 closes
to sound the horn.
• After a 10-s time-delay period, timer contact TD-1
• opens to automatically switch the horn off.
• The ladder logic program shows how an equivalent
• circuit could be programmed using a PLC.
26
Example:
Automatic sequential control
system
pump motor M1 is energized.
•As a result, M1-1 control contact
closes to seal in
M1, and the lube-oil pump motor
starts.
•When the oil is sufficient oil
pressure switch PS1 closes.
•M2 start the main and energizes
coil TD to begin the time delay.
•After 15 s, TD-1 contact closes to
energize coil M3 and start the feed
motor.
•The ladder logic program shows
how an equivalent
circuit could be programmed using a
PLC.
27
Off-Delay Timer Instruction
• The off-delay timer (TOF) operation will keep
the output energized for a time period after the
rung containing the timer has gone false.
28
Download