You are on page 1of 120

DAY - 1

PLC WORKSHOP

Basics of Programmable Logic


Controllers

Engr. Mairaj ud Din


Presentation Sequence
Basics of PLCs

 Functions of PLCs Functions Applications


of PLC of PLC
 Applications of PLCs
 Components of PLCs
Symbols Components of PLC
 Programming Devices
 Symbols Programming Devices
 Programming modes
 PLC program creation PLC Program Programming
creation Modes
 Documentation
 PLC addressing
Documentation
 Programming logic
functions PLC addressing
 Q&A
Programming
Logic Functions Q&A
Programmable Logic Controllers
PLC( programmable logical controller) is a computer type device used in
an industrial environment to control various types of machines or
processes through digital or analogue inputs and outputs.
PLCs are similar to computers except, computers are optimised for
calculation and display, PLCs are optimised for control tasks and the
industrial environment. Thus PLCs are:

• Rugged and designed to withstand vibrations,


temperature, humidity and noise.
• Have interfacing for inputs and outputs already
inside the controller.
• Easily programmed and have an easily
understood programming language which
primarily concerned with logic and switching
operations
Why PLCs

 PLC is a microprocessor based, reprogrammable device that is


used for Industrial Automation

 In addition to the programming flexibility PLCs offer other


advantages over traditional control systems. These advantages
include:

 high reliability
 small space requirements
 computing capabilities
 reduced costs
 ability to withstand harsh environments
 expandability
History

Conventional control
panel
 At the outset of industrial
revolution, especially during
sixties and seventies, relays
were used to operate
automated machines, and
these were interconnected
using wires inside the
control panel.

 In some cases a control


panel covered an entire wall.
History

Disadvantages of Conventional control panel


 Too many wiring work.
 Difficult to modify and troubleshoot => Long down time.
 Power consumption can be quite high
 Drawings are usually not updated.
 Lifetime of relay contacts was limited, so some relays had to be replaced.
 If replacement was required, machine had to be stopped and production too.
 Also, it could happen that there was not enough room for necessary changes.
 As far as maintenance, electricians had to be very skillful in finding errors.
 When a problem occurs, hold-up time is indefinite, usually long.
History
 In the late 1960's PLCs were first introduced. The primary reason for
designing such a device was eliminating the large cost involved in replacing
the complicated relay based machine control systems. Bedford Associates
(Bedford, MA) proposed something called a Modular Digital Controller
(MODICON) to a major US car manufacturer. Other companies at the time
proposed computer based schemes, one of which was based upon the
PDP-8. The MODICON 084 brought the world's first PLC into commercial
production.

 In the mid70's the dominant PLC were Modicon and A-B PLCs. The AMD
2901 and 2903 were quite popular in these PLCs

 Communications abilities began to appear in approximately 1973. The first


such system was Modicon's Modbus. The PLC could now talk to other PLCs
and they could be far away from the actual machine they were controlling.
They could also now be used to send and receive varying voltages to allow
them to enter the analog world.
History

 The 80's saw an attempt to standardize communications with General


Motor's manufacturing automation protocol (MAP). It was also a time for
reducing the size of the PLC and making them software programmable
through symbolic programming on personal computers instead of
dedicated programming terminals or handheld programmers.

 The 90's have seen a gradual reduction in the introduction of new protocols,
and the modernization of the physical layers of some of the more popular
protocols that survived the 1980's. The latest standard (IEC 1131-3) has tried
to merge PLC programming languages under one international standard.
History

Advantages of PLC based control system


 Compared to a conventional process control system, number of wires needed for
connections is reduced by 80%
 Diagnostic functions of a PLC controller allow for fast and easy error detection.
 Change in operating sequence or application of a PLC controller to a different operating
process can easily be accomplished by replacing a program through a console or using
a PC software (not requiring changes in wiring, unless addition of some input or output
device is required).
 Needs fewer spare parts.
 It is much cheaper compared to a conventional system, especially in cases
where a large number of I/O instruments are needed and when operational
functions are complex.
 Reliability of a PLC is greater than that of an electro-mechanical relay or a
timer.
PLC Architecture
Typically a PLC system has five basic components. These are the
processor unit, memory, the power supply unit, input/output
interface section and the programming device. Figure shows the
basic arrangement. Programming
Device

Memory

Input Output
Processor
Interface Interface

Power
Supply
PLC Architecture
PLC Architecture

CPU
The processor unit or central processing unit (CPU) is the unit
containing the microprocessor and this interprets the input
signals and carries out the control actions, according to the
program stored in its memory, communicating decisions as a
action signals to the output.

Power Supply Unit


The power supply unit is needed to convert the main a.c.
voltage to the low d.c. voltage (5V,24V etc) necessary for the
processor and the circuits in the input and output interface
modules.
PLC Architecture

Programming Device
The Programming device is used to enter/edit the required
program into the memory of the processor. The program is
developed in the device and then transferred to the memory unit
of the PLC.

Memory Unit
Program is stored in memory unit, and is used for the control
actions to be exercised by the microprocessor.

Input and Output Sections


The input and output sections are where the processor receives
information form external devices and communicates
information to external devices
PLC Architecture

The essential elements of a CPU are:


Registers
A register is a byte (8 bits), word ( 16 bits ) or long word (32 bits) of memory which is part
of the microprocessor as opposed to general purpose memory. A register is used for
temporary storage of data and addresses within the CPU.

ALU
The ALU performs arithmetic and logical operations such as addition and subtraction on
data stored in registers.

Control Unit
The control unit is basically a set of counters and logic gates which is driven by the block.
Its function is to control the units within the microprocessor to ensure that operations are
carried out in the correct order.
Functions of PLCs
 Functions of PLC:
 Function of a PLC is to

provide a reprogrammable,
reliable, upgradable control
solution for Industrial
Automation
 The function of an input

module is to convert incoming


signals into signals, which
can be processed by the PLC,
and to pass these to the
central control unit. The
reverse task is performed by
an output module. This
converts the PLC signal into
signals suitable for the
actuators
Applications of PLCs
...over 1,000,000 applications world wide

Overview Woodworking

Conveyor systems

Pump
controls

Filling plants Vacuum suction systems/elevators


Application examples
 Applications of PLC are wide ranging as it is designed for
Industrial Applications
 As the Industry is diversified so is the application of PLC.
 A reliable controller for every machine & system .
 Where frequent process changes are required.
 In harsh environments.
 Where the whole plant is to be controlled by central controller
with multiple loops.
 Accurate Timer and counter functions, memory setting and
resetting, mathematical computing operations when required.
 For reliable, accurate and economical automation
Control of a Sequence (Conveyor Unit)

 Here a PLC is controlling


the conveyor unit
(Diversion & Speed)
 PLC is getting info from:
 Sensors for workpiece
detection
 Sensors for conveyor
speed detection
 And controlling:
1. Diversion device
(pneumatic based)
2. Conveyor speed
Monitoring a Chemical Plant

 Here a PLC is controlling a


process
 PLC gathers information
from level sensors
 According to the level
definition of the reservoirs
opens or closes the
respective valves
 All of the actions are
executed according to the
program that is written in
the PLC
 PLC can also control the
flowrate of the fluids.
Interface Control in CNC machine

 A CNC machine requires a Interface control in CNC machine


variety of sequential control
applications like:
Program Program
 Coolant on / off
 Door open / close
 Tool changing
PLC CNC-
 Vise / chuck open / close Interface Controller
Control
 A PLC is used here in
connection with CNC
controller that enables the
machine to execute the fore Machine
stated steps Tool
Replacing Relays by PLC
Replacing Relays by PLC Continue:
Components of a PLC
Basics of PLC

 Hardware Functions
of PLC
Applications
of PLC
 Power supply
 Processor Symbols Components of PLC
 Input module
 Output module Programming Devices

 Special modules
 Temperature sensing PLC Program
creation
Programming
Modes
 Motor control
 Software Documentation
 PLC programming software
 Linking software PLC addressing

 HMI development software


Programming
Logic Functions Q&A
Components of a PLC

The Base For PLC


Components of a PLC

The Power Supply Mounted On The Base Plate


Components of a PLC

The Processor Module Mounted on the Base Plate


Components of a PLC

The Input Module Mounted on the Base Plate


Components of a PLC

The Output Module Mounted on the Base Plate


Block Diagram of PLC
Types of PLC
There are two types of PLC
1) Fixed PLC
Fixed PLC combine all of the main
components into a single unit that
contains the CPU, input/output
sections, and power supply. The
number of inputs and outputs
cannot be expanded.

2) Modular PLC
A PLC configuration in which each
component is split into a separate
unit. A modular PLC lets you have
as many inputs and outputs as you
want.
PLC Available in market

Following models of PLC are commonly available in the market.


Basics of PLC

Functions Applications
of PLC of PLC

Symbols Components of PLC

Programming Devices

PLC Program Programming


creation Modes

Documentation

PLC addressing

Programming
Logic Functions Q&A
Programming Devices

 Processor Module can


be programmed via
 Computer
 PLC programmer
 Hand Held Programmer
 Processor Module can
give output to
 Printer
 HMI panel
 Computer
 It can communicate with
other devices as well
Basics of PLC

Functions Applications
of PLC of PLC

Symbols Components of PLC

Programming Devices

PLC Program Programming


creation Modes

Documentation

PLC addressing

Programming
Logic Functions Q&A
Programming languages
Basics of PLC

 Ladder Diagram Functions


of PLC
Applications
of PLC
 Function Block Diagram
 Instruction List Symbols Components of PLC

 Structured Text Programming Devices


 Sequential Function Chart
PLC Program Programming
creation Modes

Documentation

PLC addressing

Programming
Logic Functions Q&A
Ladder diagram

 A graphic programming
language
 Derived from relay logic
 Contact Rails to the left and
the right
 These contact rails are
connected to switching
elements
Function block diagram

 Graphical Method of
programming
 Various Function blocks are
provided for the ease of
programmer, e.g.
 Logic Functions
 Math Functions
 Special Functions
 Functions blocks are
interconnected into networks,
to form a PLC program.
 Even Ladder Diagram can be
used with function blocks
Instruction List

 Instruction list is a textual LD Part_TypeA


assembler-type language OR Part_TypeB
AND Part_present
 Instruction list is formulated AND Drill_ok
from control instructions ST Sleeve_in
consisting of an operator
and an operand.
Structured Text

 Structured text programming is similar to high-level language


 Loops, control statements and function blocks can be used
 Structured text enables the formulation of numerous
applications, beyond pure function technology,
 algorithmic problems (Control)
 data handling (data analysis, processing of complex data
structures etc.).

Sleeve_in :- (Part_TypeA OR Part_TypeB) And Part_present AND Drill_ok;


Sequential Function Chart

 Used for structuring of


sequence-oriented control
programs.
 The elements SFC are
 steps,
 transitions,
 alternative and
 parallel branching.
 Hierarchical structure of a
control program is
developed.
Why there are a number of
programming options for a PLC?

To gain popularity!
Basics of PLC

Functions Applications
of PLC of PLC

Symbols Components of PLC

Programming Devices

PLC Program Programming


creation Modes

Documentation

PLC addressing

Programming
Logic Functions Q&A
Procedure for Creating a PLC
Program
 Specification:
 Description of the task
 Design:
 Description of the solution
 Realization:
 Implementation of the
solution
 Integration / commissioning:
 Incorporating into
environment and testing
Documentation
 One important and crucial component of a system is
documentation,
 Documentation is required for
 Maintenance
 Expansion of the system
 Troubleshooting PLC Program
creation
 Individually these are:
 Problem description
Documentation
 Positional sketch or technology pattern
 Circuit diagram
 Terminal diagram
 Printouts of control programs in SFC, FBD etc..
 Allocation list of inputs and outputs
 Additional documentation
PLC addressing
Basics of PLC

 Input and output Assignment Functions


of PLC
Applications
of PLC
 Electrical and pneumatic
circuit diagrams Symbols Components of PLC

Programming Devices

PLC Program Programming


creation Modes

Documentation

PLC addressing

Programming
Logic Functions Q&A
PLC addressing

Memory Area Structure OF FATEK PLC


PLC addressing

Memory Area Structure OF FATEK PLC


PLC addressing

Memory Area Structure OF SIEMENS PLC


PLC addressing
Memory Area Structure OF SIEMENS PLC
PLC addressing

Memory Area Structure OF SIEMENS PLC

 Physical Input Contacts()-


These are the external physical inputs contacts of the
PLC. Its Address in Siemens PLC is I0….. In and for
Fatek PLC is X0….Xn.

 Physical Output Coils()-


These are the external physical Outputs Coils/Relays
of the PLC. Its Address in Siemens PLC is Q0….. Qn
and for Fatek is Y0….Yn.
PLC addressing
Memory Area Structure PLC
 Internal Relay ()-
Do not have any specific function, and they can be
freely used within the program (except those
assigned to Input or Output Cards and Special I/O
Cards). Known as M area in Fatek PLC.
Retentive M(M800-1399), Internal Relay(M0-799)
and Special relays (M1912-2001)
 Work Area/Data Register (D) –
can be used only in the program;
not for I/O exchange with external I/O terminals.
D (D0-D4095), R(R0-4168)
PLC addressing
Memory Area Structure PLC

 Step Relays (S) –


These are the step relays of PLC. Known as
Retentive S(S500-999) and S(0-499) of Fatek
PLC.

 Timers(T)/ Counters(C)-
I/O Assignment

 The I/O assignment table


indicates which PLC inputs
are connected to which
input devices
 And which PLC outputs
drive which output devices.
 The assignment of
internals, including timers
and counters also takes
place here.
Electrical and pneumatic circuit diagrams

 Integration of PLC with


mechanical system.
 the electrical circuit is
replaced with the ladder
diagram of PLC
 and is connected to the
pneumatic circuit
accordingly
 Here a solenoid operated
valve is connected to the
PLC.
Basics of PLC

Functions Applications
of PLC of PLC

Symbols Components of PLC

Programming Devices

PLC Program Programming


creation Modes

Documentation

PLC addressing

Programming
Logic Functions Q&A
Programming of logic functions
Ladder Diagram

• A graphical representation use


by engineers for their relay logic.

• Adopted by PLC makers as a


programming language due to its
simplicity. Thus the term Ladder
Programming shown in figure.

• Fatek PLC programmer


WinProLadder.
Symbols of Ladder Diagram
Symbols of Ladder Diagram

Y0 This is a representation of a relay coil. The


number represents the relay.

X0 This is a normally open contact symbol. It will


be closed if the coil of the same number is
energised.

X0 This is a normally closed contact symbol. It


will open upon the energising of the coil of the
same number
SIMATIC S7-200
S7-200 Second Generation Overview
CPU 221 CPU 222 ) CPU 224
(10 I/O Points) (14 I/O Points) (24 I/O Points)
Overview

CPU 224XP CPU 226


(24 I/O Points) (40 I/O Points)
Built-in Features Internal:
CPU Status I/O Point - Power Supply
LEDs Status LEDs - Super Capacitor
Cartridge - Clock
Overview
Slot (224(XP),226)

Communication
Port(s)

24V Sensor
Removable Mounting Holes for
Power
Terminal Blocks Panel Installation
Output
(224(XP),226) Snap-On Clip
for DIN Rail Mounting
Please sit infront of Individual PCs and
Open WinProLadder placed on DeskTop.

Practice on Simple Ladder Logic


Programming
Review on Logic Gates

NOT Gate, OR Gate, Nor Gate, And


Gate, Nand Gate, XOR Gate, Etc.

Equation & Truth Table of Gates

Practice Session
Programming of logic functions

 Basic Logic Functions


 Not
 Or
 And
 Memory

 The figure is showing the


relay logic for AND and OR
operation
Negation (NOT Gate)

 The output signal assumes the value 1, if the


input signal has the value 0 and vice versa.
Negation (NOT Gate)

Exercise 1:
 Lamp H1 is illuminated as
long as switch S1 is not
actuated;
 It is extinguished, if the
switch is closed. The
purpose of S1 is therefore
to switch off the lamp.
Negation (NOT Gate)

Solution:
AND-Operation

 The output signal only assumes the value 1, if all


input signals have the value 1.
AND-Operation

Exercise 2:
 Lamp H1 is to be switched
on only if the two switches
S1 and S2 are actuated.
AND-Operation

Solution:
NAND-Operation

 The output signal only assumes the value 1, if all input


signals have the value 1.
NAND-Operation

Exercise 3:
 The output signal only
assumes the value 1, if all
input signals have the
value 1.

 Lamp H1 is to be switched
on only if the two switches
S1 and S2 are actuated.
NAND-Operation

Solution 3:
OR-Operation

 The output signal assumes the value 1, if at least one input


signal has the value 1.
OR-Operation

Example 4:
 Lamp H1 is to be switched
on, if at least one switch, S1
or S2 is actuated.
OR-Operation

Solution 4:
NOR-Operation

 The output signal assumes the value 1, if at least one


input signal has the value 1.
NOR-Operation

Example 5:
 Lamp H1 is to be switched
on, if at least one switch, S1
or S2 is actuated.
NOR-Operation

Solution 5:
Exclusive OR-Operation

 The output signal assumes the value 1, if at least one


input signal has the value 1.
Exclusive OR-Operation

Example 6:
 Lamp H1 is to be switched
on, if at least one switch, S1
or S2 is actuated.
Exclusive OR-Operation

Solution 6:
Memory Function

 The standard function block


SR
 a dominant setting flipflop
(bistable memory with
preferred status 1).
 A 1-signal at S1 sets the
value of Q1
 A 1-signal at R only brings
output Q1 to value 0
 The standard function block
RS
 a dominant resetting flipflop
(bistable memory with
preferred status 0).
Memory Function

 Exercise:
 If sensor B1 has a 1-Signal, this indicates an error status in
the system. A horn H1 is sounded.
 The horn can only be switched off by actuating push-button
S1. It is possible to switch off the horn, even if the B1-
signal continues to be applied.
Memory Function
DAY-2
Programming Techniques

• Symbolic Addressing
• Latches
• Timers
• Single Shot Pulse
• Counters

National Institute of Design & Analysis 89


Symbolic Addressing

National Institute of Design & Analysis 90


Symbolic Addressing

National Institute of Design & Analysis 91


Latches
Latch circuit is used to maintain the status of output based
on two execution conditions. These conditions are SET &
RESET. When SET condition is true, output turns ON and
stay ON, until reset condition is true. When RESET
condition is true, output turns OFF and stay OFF, until SET
condition is true.
SET condition

RESET condition

Output

National Institute of Design & Analysis 92


Latches

National Institute of Design & Analysis 93


Latches

National Institute of Design & Analysis 94


TIMER

National Institute of Design & Analysis 95


TIMER

National Institute of Design & Analysis 96


TIMER

National Institute of Design & Analysis 97


Timers and Creating Delay

A timer is activated when its execution condition goes


ON. If the execution condition remains ON long
enough for TIM to time down to zero, the output for the
TC number used will turn ON and will remain ON, until
TIM is reset. TIM measures in units of 0.1 second from
the Set Value.

Input
Condition

Output
T1
National Institute of Design & Analysis 98
Timers and Creating Delay

National Institute of Design & Analysis 99


DELAY ON TIMER

National Institute of Design & Analysis 100


DELAY ON TIMER

National Institute of Design & Analysis 101


DELAY ON TIMER

EXAMPLE: Write a program to on a motor after 10 seconds


When switch S1 is on

National Institute of Design & Analysis 102


DELAY ON TIMER
Solution:

National Institute of Design & Analysis 103


DELAY OFF TIMER

EXAMPLE: Write a program to on a motor for 100 seconds


When switch S1 is on.

National Institute of Design & Analysis 104


DELAY OFF TIMER
Solution:

National Institute of Design & Analysis 105


Retentive or Accumulating timer

National Institute of Design & Analysis 106


Retentive or Accumulating timer
Example:

National Institute of Design & Analysis 107


TIMER

National Institute of Design & Analysis 108


Single-Shot Circuit
 This circuit is used to keep the ON time of an
input signal.

Input
Signal

Output
T1 T1

National Institute of Design & Analysis 109


Single-Shot Circuit

National Institute of Design & Analysis 110


COUNTER

National Institute of Design & Analysis 111


COUNTER

National Institute of Design & Analysis 112


COUNTER

National Institute of Design & Analysis 113


COUNTER

National Institute of Design & Analysis 114


COUNTER

EXAMPLE: Write a program to count a number of samples


( box, apples, bottles etc) up to 10 and then stop the
conveyor motor.

National Institute of Design & Analysis 115


COUNTER

National Institute of Design & Analysis 116


COUNTER

National Institute of Design & Analysis 117


COUNTER

National Institute of Design & Analysis 118


Retentive or Accumulating timer

EXAMPLE: Write a program to count the existing bottles on


a conveyor belt by using S1 at the entrance and S2 at
outlet. If bottles are 4 then on alarm AL1. Use S3
pushbutton for reset.

National Institute of Design & Analysis 119


COUNTER

National Institute of Design & Analysis 120

You might also like