0% found this document useful (0 votes)
3 views70 pages

Lecture7 A

The document provides an overview of Programmable Logic Controllers (PLCs), detailing their development, advantages over relay logic controllers, internal architecture, and working principles. It discusses the components of PLCs, including the CPU, memory units, input/output units, and communication units, as well as the PLC scan cycle and programming languages. Additionally, it includes examples of ladder logic programming and practical applications of PLCs in controlling processes and devices.

Uploaded by

Nafis Sadik
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views70 pages

Lecture7 A

The document provides an overview of Programmable Logic Controllers (PLCs), detailing their development, advantages over relay logic controllers, internal architecture, and working principles. It discusses the components of PLCs, including the CPU, memory units, input/output units, and communication units, as well as the PLC scan cycle and programming languages. Additionally, it includes examples of ladder logic programming and practical applications of PLCs in controlling processes and devices.

Uploaded by

Nafis Sadik
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 70

Programmable Logic Controller (PLC)

Programmable Logic Controller (PLC)


• The first PLC was developed in 1969
• A programmable logic controller (PLC) is a special form of
microprocessor-based controller that uses programmable
memory to store instructions and to implement functions
such as logic, sequencing, timing, counting, and arithmetic in
order to control machines and processes

• It is designed to be operated by engineers with perhaps a


limited knowledge of computers and computing languages
Advantages of PLC over Relay Logic Controllers
• PLCs are programmable. Thus, any changes in the control
process can be made by modifying the user program rather
than changing physical wired connections
• Dimension of controller can be reduced by replacing large
number of control relays through software programming,
which means less hardware failure
• Relay controllers are noisy whereas control system
implemented with PLC’s are silent in operation
• Operation is faster than relay logic
• Special functions such as time delay actions, counters are easy
to implement in software
Advantages of PLC over Relay Logic Controllers

PLC based control system

Relay based control system


PLC Hardware

• The basic functional components are:


processor unit, memory unit, power supply unit, input/output
interface section, communications interface, and the
programming device
Working Principle
• Input devices (that is, sensors such as switches) and output
devices (motors, valves, etc.) in the system being controlled
are connected to the PLC
• The operator then enters a sequence of instructions, a
program, into the memory of the PLC
• The controller then monitors the inputs and outputs
according to this program and carries out the control rules for
which it has been programmed
• To perform small modifications in the control system and the
rules that are to be used; there is no need to rewire the whole
system. The modification can be done by changing the
sequence of instructions only
Internal Architecture
Central Processing Unit (CPU)
• The CPU contains the microprocessor and the internal
structure of the CPU depends on the microprocessor
concerned
• The microprocessor contains an Arithmetic Logic Unit
(ALU) for data manipulation and carrying out arithmetic
operations and logic operations
• This unit interprets the input signals and carries out the
control actions according to the program stored in its
memory
The Buses
The buses are the paths used for communication within the PLC.
In the physical sense, a bus is just a number of conductors along
which electrical signals can flow.
Data Bus: carries the data used in the processing done by the
CPU
Address Bus: carry the addresses of memory locations and in
order to read/write data at a memory location, it is accessed by
the CPU based on its address
Control Bus: carries the signals used by the CPU for control, such
as to inform memory devices whether they are to receive data
from an input or send data to an output port
System Bus: used for communications between the input/output
ports and the input/output unit
Memory Units
ROM (Read Only Memory):
• gives permanent storage for the operating system and fixed
data used by the CPU
• has the ability to retain stored information when power is
removed
• Information in the ROM is placed by the manufacturer and
can only be read by the user

EPROM (Erasable and Programmable ROM):


• can be used to store programs permanently until it is erased
intentionally
• often used as backup for program developed in RAM
RAM (Random Access Memory):
• User’s program is stored in RAM
• Portion of RAM is used for data storage such as the status of
the input/output devices, the values of the timers and
counters and other internal devices
• User can read the information stored in RAM and can also
write/update information into the memory
• In case of interruption of power supply the information stored
in RAM will be removed. Thus, battery backup is sometimes
used to preserve the RAM contents for a period of time
• Often the program developed in RAM is transferred to EPROM
to preserve program, until the contents of EPROM is modified
again
Input/Output Units

• The input/output unit PLC


provides the interface P00 P40

between the system P01 P41

Output ports
Input ports
and the outside world P02 P42

• Input devices can be


P03 P43

P04 P44
switches, different P05 P45

sensors, limit switches P06 P46

etc. P07 P47

• Output devices can be COM COM

lights, motors, solenoid


valves etc. I/O units of PLC
Device Connections to Input/Output Ports

PLC
P00 P40 L
P01 P41

P02 P42

P03 P43

DC DC
P04 P44

P05 P45

P06 P46

P07 P47

COM COM
Internal Circuit Configuration of an Input Port

PLC Vcc
P00 LED to
R indicate
P01
status of
P02 port P00

P03
Internal
DC
P04 Circuit
Opto-Coupler (CPU)
P05

P06

P07

COM
AC Input Port (Internal Circuit Configuration)

Bridge Rectifier
R1
Pxx

Vcc
LED to
indicate
status of
port P00
R2

COM Internal
Circuit
Opto-Coupler (CPU)
Internal Circuit Configuration of an Output Port
Relay type: (for both AC & DC operation)

Vcc PLC
LED to P40 L
indicate
status of P41

port P40 P42

Internal P43
AC/DC
Circuit R P44 Source
(CPU)
P45

P46

P47

COM
Internal Circuit Configuration of an Output Port
Transistor type: (for DC operation)

Vcc PLC
LED to P40 L
indicate
R P41
status of
port P40 P42

Internal P43

Circuit DC
P44
(CPU) Vcc
P45

Opto-Coupler P46

P47

COM
Internal Circuit Configuration of an Output Port
TRIAC type: (for AC operation)

Vcc PLC
LED to P40 L
indicate
status of P41

port P40 P42


R
Internal P43 AC
Circuit
P44
(CPU) Vcc
P45

Opto-Coupler P46

P47

COM
Hardware Wiring
Input wiring
Hardware Wiring
Output wiring
Sourcing and Sinking
The terms sourcing and sinking are used to describe the way in
which DC devices are connected to a PLC.
• Input Sourcing: input device receives current from the input
module, that is, the input module is the source of the current
• Input Sinking: an input device supplies current to the input
module, that is, the input module is the sink for the current

(a) Sourcing (b) Sinking


Sourcing and Sinking
• Output Sourcing: if the current flows from the output module
to an output load, the output module is referred to as
sourcing
• Output Sinking: if the current flows to the output module
from an output load, the output module is referred to as
sinking

(a) Sourcing (b) Sinking


Communication Unit
Manages communication between the PLC and a PC, different
peripherals, other PLCs and the controlled processes. Different
types of communication ports available in PLC are:

Serial Ports:

Mini-DIN or PS/2

USB Mini-B

RS-232 / RS-485
Purpose of serial ports:
• to upload the program from PC into PLC
• to connect other peripheral devices
• device verification, data acquisition, synchronization between
user applications

Ethernet Port:

Can be used to form a Local


Area Network (LAN) to
establish interconnection and
data exchange between
multiple PLCs and other
industrial automation devices
PLC Scan Cycle
Scan cycle consists of 3 important
steps:
Step 1-CHECK INPUT STATUS
First the PLC takes a look at each
input to determine if it is on or
off. It records this data into its
memory to be used during the
next step.
Step 2-EXECUTE PROGRAM
Next the PLC executes the
program one instruction at a
time. It will store the execution
results for later use during the
next step.
Step 3-UPDATE OUTPUT STATUS
Finally the PLC updates the status of the outputs. It updates the
outputs based on which inputs were ON during the first step and
the results of executing the program during the second step.
After the third step the PLC goes back to step one and repeats
the steps continuously.
Programming Languages for PLC

Most common languages encountered in PLC programming are:


• Ladder Logic
• Functional Block Diagram
• Sequential Function Chart
• Boolean mnemonics
Ladder Diagrams

Basic Electrical Diagram Ladder Diagram

• In a Ladder 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
called, are like the vertical sides of a ladder, with the
horizontal circuit lines similar to the rungs of the ladder.
PLC Ladder Programming
A very commonly used method of programming PLCs
• 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.
• Each rung on the ladder defines one operation in the control
process.
• A ladder diagram is read from left to right and from top to bottom.
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.
• Each rung must start with an input or inputs and must end with at
least one output.
• Electrical devices are shown in their normal condition. Thus a
switch that 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.
• 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
contacts. The same letters and/or numbers are used to label the
device in each situation.
• The inputs and outputs are all identified by their addresses; the
notation used depends on the PLC manufacturer. This is the address
of the input or output in the memory of the PLC
A PLC
Logic Functions B
P00 P40 Output
P01 P41

AND Gate: P02

P03
P42

P43

DC DC
P04 P44

P05 P45

P06 P46

P07 P47

COM COM
A PLC
Logic Functions B
P00 P40 Output
P01 P41

OR Gate: P02

P03
P42

P43

DC DC
P04 P44

P05 P45

P06 P46

P07 P47

COM COM
A PLC
Logic Functions P00 P40 Output
P01 P41

NOT Gate: P02

P03
P42

P43

DC DC
P04 P44

P05 P45

P06 P46

P07 P47

COM COM
A PLC
Logic Functions B
P00 P40 Output
P01 P41

NAND Gate: P02

P03
P42

P43

DC DC
P04 P44

P05 P45

P06 P46

P07 P47

COM COM
A PLC
Logic Functions B
P00 P40 Output
P01 P41

NOR Gate: P02

P03
P42

P43

DC DC
P04 P44

P05 P45

P06 P46

P07 P47

COM COM
PLC
Logic Functions A

P00 P40 Output


B
P01 P41

Exclusive OR (XOR)Gate: P02 P42

P03 P43

DC DC
P04 P44

P05 P45

P06 P46

P07 P47

COM COM
Programming Example
• Ladder circuit of Start/Stop of motor:

Start
PLC
P00 P40 Motor
Stop
P01 P41

P02 P42

P03 P43

DC DC
P04 P44

P05 P45

P06 P46

P07 P47

COM COM
• Programming PLC:
Start
PLC
P00 P40 Motor
Stop
P01 P41

P02 P42

P03 P43

DC DC
P04 P44

P05 P45

P06 P46

P07 P47

COM COM
• Starting of Motor:
Start PLC
(actuated)
P00 P40 Motor
Stop
P01 P41

P02 P42

P03 P43

DC
P04 P44

P05 P45

P06 P46

P07 P47

COM COM
• Continuous running of motor when start button is released:
Start
(released)
PLC
P00 P40 Motor
Stop
P01 P41

P02 P42

P03 P43

DC DC
P04 P44

P05 P45

P06 P46

P07 P47

COM COM
• Stopping the motor:
Start PLC
P00 P40 Motor
Stop(actuated)
P01 P41

P02 P42

P03 P43

DC DC
P04 P44

P05 P45

P06 P46

P07 P47

COM COM
Multiple Outputs:
Example
• First Priority Circuit:
There are 3 participants in a quiz game. If they want to get the
chance of answering the question from the host, they must
press the answer button on their table first, which will turn on
a lamp in their respective table. Other participants’ pressing
will be invalid if any participant presses the button before
them. The host will have an option to Reset the whole system.
Hardware Connection:

Reset
PLC
P00 P40 Lamp 1
Button 1
P01 P41 Lamp 2
Button 2
P02 P42 Lamp 3
Button 3
P03 P43

DC DC
P04 P44

P05 P45

P06 P46

P07 P47

COM COM
Ladder Logic Program:

Here, No Button is pressed


Ladder Logic Program:

Here, Button 1 is pressed


Ladder Logic Program:

Now, if Button 1 is released, lamp 1 will continue to glow due to latching


Ladder Logic Program:

Until the host presses the Reset button input from other buttons will be
invalid due to the open circuit in the respective rung. Here, Button 2 is
pressed, but the corresponding lamp will not glow due to the open circuit.
Ladder Logic Program:

Here, the Reset button is pressed and momentarily the whole circuit gets
disconnected from power supply and all the contacts are reset to their
initial state.
P 0000 F P 0000 1
P 0001 A

P 0000 F E D C B A 9 8 7 6 5 4 3 2 1 0

P 0001 F E D C B A 9 8 7 6 5 4 3 2 1 0

P 0002 F E D C B A 9 8 7 6 5 4 3 2 1 0

P 0003 F E D C B A 9 8 7 6 5 4 3 2 1 0
.. ..
. .
. .
. .
. .
. .
. P 1023 F
.
. .
P 1023 F E D C B A 9 8 7 6 5 4 3 2 1 0
Timers
Timers can be categorized into three groups according to their resolution. For
example, the total number of built in timer in XGB PLC series is 1024 (T0000-
T1023). Based on resolution these 1024 timers can be categorized into
following three categories:
• 100ms Timer:
Timing step of this type of timer is 100ms. Their total number in XGB PLC
series is 500; beginning from T000 to T499.
• 10ms Timer:
Timing step of this type of timer is 10ms. Their total number in XGB PLC
series is 500; beginning from T500 to T999.
• 1ms Timer :
The gap between two timing interval is 1ms for these timers. Their total
number in XGB PLC series is 24; beginning from T1000 to T1023.

Expected time delay can be calculated in terms of timer resolution as follows:

where, y is the expected time; r is the resolution; and t is the time constant.
Timer Classification for XGB PLC series
There are five types of timer used in XGB ladder program. They
are mentioned below:
• ON Delay timer (TON)
• OFF Delay timer (TOFF)
• Integration or Momentary delay timer (TMR)
• Mono-stable timer (TMON)
• Re-trigger timer (TRTG)
ON Delay Timer (TON):
• Delay period counting will start from (+ve) edge of I/P trigger pulse.
• Without interruption after delay period counting (t), timer o/p will be
high.
• The o/p of the timer will be kept high until i/p trigger pulse will be
continuing high after delay period.
OFF Delay Timer (TOFF):
• Timer high state will start with the positive edge of the i/p pulse.
• Delay period counting will start from (-ve) edge of I/P trigger pulse.
• After delay period counting, o/p of the timer will be low from high state.
Integration or Momentary delay timer (TMR):
• At beginning, timer o/p state will remain low.
• Whenever the sum of the duration of the interrupted momentary pulses is
equal to preset time duration then the o/p of the timer will go to high state
from low state. The high state will be continued until providing reset signal.
Mono-stable timer (TMON):
• At beginning, the timer o/p will remain high. After getting (+ve) edge of i/p
trigger pulse, delay period counting will start. No interruption signal will
be allowed during delay period counting.
• After delay period counting, the o/p of the counter will be low from high
state.
Re-trigger timer (TRTG):
• After getting the positive edge i/p pulse, the timer o/p will remain high
and delay period counting will start.
• However, if the input pulse trigger again means if it gets another positive
edge i/p pulse, the counting of the delay period will get reset. That’s why
this is called re-trigger timer.
Counters
In PLC, counter is a function to count input pulses to activate or
deactivate dependent operation. A counter instruction compares
an accumulated count value to a preset value to determine when
the desired action has been done. Counter can be used to start
an operation when a count is reached to the preset value or to
prevent an operation from occurring when the counting has
reached the preset value.

For example, there are 256 (C000-C255) counter functions built


in XGB PLC CPU.

Different types of counters are briefly described in the following


slides.
Up Counter (CTU):
• Up counter will count in upwards direction. At beginning, for each input
trigger pulse, it will increase the counting value to the preset value from
zero. Whenever counting value will be equal to the preset value then the
o/p of up counter will be high until getting reset signal.

Down Counter (CTD):


• Down counter will count in downwards direction. At beginning, for each
input trigger pulse, it will decrease the counting value from the preset
value towards zero. Whenever counting value will be equal to zero then
the o/p of down counter will be high until getting reset signal.
Ring Counter (CTR):
• It’s counting sequence is analogous cyclic order.
• At beginning, starting from zero it will count upwards upon
receiving each input trigger pulse. Whenever it reaches the preset
value then the output of the ring counter will be high
• Immediate next pulse after being high, the ring counter will be
reset.
• After the pulse of reset, it will follow counting like above mentioned
manner. For this reason, it is called ring counter.
Up-down counter (CTUD):
• Up-down counter is bi-directional counter. So, it will have two
inputs, one for incremental and another for decremental operation.
• If difference of incremental and decremental value is equal to
preset value then the o/p of the up-down counter will be high.

CTUD

Where, C means Counter serial among 256 counter; U means memory


for up counting; D means memory for down counting; c means preset
value
Example: Traffic Light Sequence Control

Traffic light sequence

1. Turn on R1 and G2 for 30 sec


G1 Y1 R1
2. After 30 sec turn on Y1 and Y2 for 5
sec with R1 and G2 still in on-state
R2
3. After 5 sec delay turn off R1, G2, Y1
Y2
G2
and Y2
4. Then, turn on G1 and R2 for 30 secs
G2
Y2 5. After this 30 sec delay again turn on
R2
Y1 and Y2 for 5 sec with G1 and R2
still in on-state

R1 Y1 G1 6. After this 5 sec delay turn off G1, R2,


Y1 and Y2
7. Continue from step 1
Example: Traffic Light Sequence Control

Connections to PLC input ports


P00 → Stop
G1 Y1 R1
P01 → Start

R2
Y2 Connections to PLC output ports
G2
P40 → G1
G2
Y2 P41 → Y1
R2
P42 → R1
P43 → G2
R1 Y1 G1
P44 → Y2
P45 → R2
Connections to PLC input/output ports
P00 → Stop P40 → G1
P01 → Start P41 → Y1
P42 → R1
P43 → G2
P44 → Y2
P45 → R2
Ladder Logic Program:
Example: A counting task
Let us consider, that some manufactured items are moved in a particular
direction with the help of a conveyor belt. The conveyor belt is driven by a
motor. It is required to design a control system to direct six items along one
path for packaging in a box and then 12 items along another path for
packaging in another box. A photocell sensor is used to detect the presence
of an item. The number of pulses from the sensor has to be counted and
depending upon that a deflector plate has to be controlled to guide the item
towards a particular box for packaging.

12 item
Box

6 item Box
Photocell
sensor
Example: A counting task
12 item
Box
Connections to PLC input ports
P00 → Stop
P01 → Start
6 item Box
Photocell P02 → Photo sensor
sensor
Connections to PLC output ports
P40 → Motor for driving the
conveyor
P41 → Deflector plate
Connections to PLC input ports
Ladder Logic Program:
P00 → Stop
P01 → Start
P02 → Photo sensor
Connections to PLC output ports
P40 → Motor for driving the
conveyor
P41 → Deflector plate

You might also like