0% found this document useful (0 votes)
155 views99 pages

Lecture 01 - Introduction To PLC 2022 Nov

The document provides an introduction to programmable logic controllers (PLCs) for industrial applications. It discusses why PLCs are better suited than microcontrollers for industrial control due to their ability to withstand harsh environments. The document outlines the basic components of a PLC system including the processor unit, input/output modules, power supply, and programming device. It also summarizes some key advantages of PLCs such as flexibility, reliability, communication capabilities, and easier troubleshooting compared to hardwired relay panels.
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)
155 views99 pages

Lecture 01 - Introduction To PLC 2022 Nov

The document provides an introduction to programmable logic controllers (PLCs) for industrial applications. It discusses why PLCs are better suited than microcontrollers for industrial control due to their ability to withstand harsh environments. The document outlines the basic components of a PLC system including the processor unit, input/output modules, power supply, and programming device. It also summarizes some key advantages of PLCs such as flexibility, reliability, communication capabilities, and easier troubleshooting compared to hardwired relay panels.
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/ 99

ME 4210 - Analog and 1

Digital Electronics
Introduction to Programmable 4

Logic Controllers (PLC)

5 6

ME 4210 – Analog and Digital Electronics 1


Outline
▪ Introduction to PLC

▪ Ladder Programming

▪ Examples

ME 4210 – Analog and Digital Electronics 2


Introduction to PLC

ME 4210 – Analog and Digital Electronics 3


1

Why we can’t use microcontrollers )like Arduino,


raspberry pi) for industrial applications?

Why PLC?

ME 4210 – Analog and Digital Electronics 4


Automation
• Replace human muscle by machine
• Replace human brain by Intelligent control
• Minimize or completely replace human supervision

Defining Automation Systems


• Automation systems can be classified into two main
categories according to the type of processing signals.

➢ Discrete
➢ Continuous

ME 4210 – Analog and Digital Electronics 5


Control Systems

Discrete Control Continuous Control


(No feedback of (with feedback of
performance) performance)

Combinational Logic

Sequential Logic

ME 4210 – Analog and Digital Electronics 6


2
Continuous Process Control

▪ Parameters and variables that change values continuously in time fall


under the scope of continuous process control systems.

▪ Performs feedback control,


Ex: feedback of the performance of the control system

➢ Uses analog signals

➢ Deals with
Stability
Accuracy
Speed of response

ME 4210 – Analog and Digital Electronics 7


3
Discrete Process Control
▪ Parameters and variables that change value at discrete moments in
time fall under the scope of discrete process control systems.
▪ Known as open-loop control
▪ Generally, no performance feedback
▪ Uses binary signal, 0 or 1
▪ Deals mainly with
AND, OR and NOT logic
Latching (memory)
Sequencing
Time delay
Counter

This type of control can be further divided into Combinational

logic control and sequential control.


ME 4210 – Analog and Digital Electronics 8
Discrete Process Control

Combinational logic control


Combinational logic refers to circuits whose output is a function of
the present value of the inputs only. As soon as inputs are changed,
the information about the previous inputs is lost, that is,
combinational logic circuits have no memory.

Sequential logic control


Sequential logic circuits are those whose outputs are also dependent
upon past inputs, and hence outputs. In other words, the output of a
sequential circuit may depend upon its previous outputs and so in
effect has some form of "memory”.

ME 4210 – Analog and Digital Electronics 9


Sequential logic control

Source : https://www.electronics-tutorials.ws/wp-content/uploads/2013/08/seq4.gif?fit=379%2C179

ME 4210 – Analog and Digital Electronics 10


Discrete sensors
Sensors which provide a discrete set of output
corresponding to process variables.

• Switches
• Push buttons
• Proximity detectors
• Limit switches

ME 4210 – Analog and Digital Electronics 11


Discrete output and actuation devices

• Relays, Contactors
• Motor starter
• Solenoids

ME 4210 – Analog and Digital Electronics 12


Industrial Example for Discrete Control

ME 4210 – Analog and Digital Electronics 13


Industrial logic/sequential control

ME 4210 – Analog and Digital Electronics 14


Previously used control panels containing,

▪ Electromechanical or solid-state relays


▪ Contactors
▪ Switches
▪ Indicator lamps
▪ Mechanical or electronic timers and counters etc.

All components were hard wired by complex and elaborate


wiring.

ME 4210 – Analog and Digital Electronics 15


Panel of Relays

Source : https://c8.alamy.com/comp/RP3CB9/electric-service-panel-with-many-3-phase-contactors-and-relays-RP3CB9.jpg
https://previews.123rf.com/images/phadventure/phadventure1512/phadventure151200072/50159684-electrical-control-panel-with-relays-and-wires-closeup.jpg

ME 4210 – Analog and Digital Electronics 16


4
Panel of Relays

▪ Very time consuming to wire

▪ Difficult to modify

▪ Difficult to maintain

▪ Challenging to diagnose problems

ME 4210 – Analog and Digital Electronics 17


Introduction to PLC

▪ Programmable Logic Controllers, also referred to as programmable


controllers at today's context, are in computer family.

▪ 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. It uses programmable memory to store
instructions and specific functions that include on/off control,
timing, counting, sequencing, arithmetic and data handling.

▪ Used extensively because the PLC,


• Is easy to set up and program
• Behaves predictably
• Ruggedized design

ME 4210 – Analog and Digital Electronics 18


PLC’s

ME 4210 – Analog and Digital Electronics 19


History of PLCs
▪ The first PLC systems evolved from conventional computers in the
late 1960s and early 1970s.

▪ These first PLCs were installed primarily in automotive plants.

▪ Traditionally, the auto plants had to be shut down for up to a month


at model changeover time.

▪ The early PLCs were used along with other new automation techniques
to shorten the changeover time.

▪ One of the major time-consuming changeover procedures had been the


wiring of new or revised relay and control panels

▪ The PLC keyboard reprogramming procedure replaced the rewiring of a


panel full of wires, relays, timers and other components

▪ The new PLCs helped reduce change over time to a matter of a few
days.
ME 4210 – Analog and Digital Electronics 20
Functions of a PLC

ME 4210 – Analog and Digital Electronics 21


5
Advantages
▪ More Flexibility: It is easier to create and change a program in a PLC than
to wire and rewire circuit. Updates can be done very easily
▪ Lower cost: Comparing to relay control panels PLCs are less expensive.
▪ Increased reliability: Once a program has been written and tested it can be
downloaded to other PLC’s. Solid state Devices are more reliable than
mechanical systems.
▪ Faster response time: PLCs operate in real-time and have the capability of
react in a fraction of a second.
▪ Communication Capability: PLC’s can be networked to perform such functions
as, supervisory control, data gathering, monitoring devices and process
parameters.
▪ Easier to troubleshoot: The control program can be watched in real-time as
it executes to find and fix problems.
▪ Less and simpler wiring
▪ Handles complicated control systems
▪ Rugged design to withstand harsh industrial environments.
▪ Takes much less space
ME 4210 – Analog and Digital Electronics 22
Hardware components PLC system

ME 4210 – Analog and Digital Electronics 23


Hardware components PLC system
▪ Processor unit – CPU
▪ Input/Output
▪ Power Supply Unit
▪ Programming device

Source : https://sc02.alicdn.com/kf/Hdfc7220b2884425c86884ce5f0c045a9L.jpg_350x350.jpg
https://www.tk-siemens.com/Upload/Articles/2019/29/siemens-s7-300-plc.jpg
https://miro.medium.com/max/2552/1*UyVjYzAXlmoTyBeStwUbzg.jpeg
ME 4210 – Analog and Digital Electronics 24
CPU

▪ Brain

▪ Consist of a microprocessor for implementing logic, and


controlling the communications among the modules

▪ The processor accepts input data from various sensing


devices, executes the stored user program and sends
appropriate output commands to control devices which are
connected to outputs.

ME 4210 – Analog and Digital Electronics 25


6
Input / Output

Fixed I/O

▪ In Small PLCs

▪ Compact together as a one


package with no separate
removable units

▪ The Processor and I/O are


packed together

▪ Lower cost - low flexibility

ME 4210 – Analog and Digital Electronics 26


7
Input / Output
Modular I/O

▪ Different Input and Output


modules can be connected to with
the processor.

▪ Uses a DIN rail mount

▪ Increases the flexibility

ME 4210 – Analog and Digital Electronics 27


Input / Output
▪ Input and output modules are connected to the PLC bus to
exchange data with the processor unit

▪ Expansion modules,
• Digital Input Modules
• Digital Output Modules
• Analog Input Modules
• Analog Output Modules
• Communication Modules
• Special Purpose Modules
• High speed counting
• High accuracy positioning
• On-line self optimizing control
• Multi axis synchronization, interpolation.
(This module may contain additional processors)

ME 4210 – Analog and Digital Electronics 28


Power Supply Unit

▪ Most PLC controllers work either at 24


VDC or 220 VAC.

▪ Some PLC controllers have electrical


supply as a separate module, while
small and medium series already contain
the supply module.

▪ In small PLC systems, the power supply


is also used to power field devices.

ME 4210 – Analog and Digital Electronics 29


Programming Device

▪ A PC is most commonly used a


programming device

▪ The software allows users to create,


edit, document, store and troubleshoot
programs
▪ Siemens – Simatic Step 7 (or TIA portal/ Simatic
Step 7automation manager)
▪ Xinje PLC – XCP Pro software
▪ Allenbradley – RSLogix
▪ Haiwell – Haiwell Happy

▪ Hand – held programming devices


▪ Compact, inexpensive and easy to use.
▪ But are not able to display as much logic
on screen ascomputers

ME 4210 – Analog and Digital Electronics 30


PLC Architecture

ME 4210 – Analog and Digital Electronics 31


T16S2T (Haiwell) 230V AC 24V DC Input
Power Output Terminals

Indicators
• Power
• RUN
Ethernet • Communication
Port • Error

Port for
RS232
Expansion
Interface
Modules

Output
Terminals
ME 4210 – Analog and Digital Electronics 32
Sinking & Sourcing
▪ Sinking and Sourcing are terms used to define the control of direct
current flow in a load.

▪ A sinking digital I/O (input/output) provides a grounded connection to


the load.
▪ SINKING = Common GND line (-)

▪ A sourcing digital I/O provides a voltage source to the load.


▪ SOURCING = Common VCC line (+)V

ME 4210 – Analog and Digital Electronics 33


PLC wiring

ME 4210 – Analog and Digital Electronics 34


PLC programming languages

ME 4210 – Analog and Digital Electronics 35


Number Systems

ME 4210 – Analog and Digital Electronics 36


Number Systems

Three number systems


• Decimal
• Binary
• Hexadecimal

All number systems have the same three characteristics


• Digits
• Base
• Weights

ME 4210 – Analog and Digital Electronics 37


Decimal

▪ Digits: 0,1,2,3,4,5,6,7,8,9
▪ Base: 10
▪ Weights: 1,10,100,1000, ……

ME 4210 – Analog and Digital Electronics 38


Binary

▪ Digits: 0,1
▪ Base: 2
▪ Weights: 1,2,4,8,16, ……

ME 4210 – Analog and Digital Electronics 39


Hexadecimal

▪ Uses sixteen symbols


as digits of a number

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

▪ Short form notation


for binary number
(each hexadecimal digit
represents a group of 4
bits)

ME 4210 – Analog and Digital Electronics 40


Logic 0, Logic 1

▪ PLCs with digital I/O modules can


understand a signal that is either
On or Off

▪ So binary system is used

▪ Binary 1 indicates that a signal


is present

▪ Binary 0 indicates that signal is


not present

ME 4210 – Analog and Digital Electronics 41


Digital Systems

▪ The main difference between a signed and an unsigned number is, well,
the ability to use negative numbers.
▪ Unsigned numbers can only have values of zero or greater.
▪ In contrast, signed numbers are more natural with a range that includes
negative to positive numbers.

ME 4210 – Analog and Digital Electronics 42


Operation of a PLC

ME 4210 – Analog and Digital Electronics 43


Operation of a PLC

ME 4210 – Analog and Digital Electronics 44


Memory structure of a PLC

ME 4210 – Analog and Digital Electronics 45


RAM

▪ Random Access Memory (RAM) is memory where data can be directly


accessed at any address.

▪ Data can be written to and read from RAM.

▪ RAM is used as a temporary storage area.

▪ RAM is volatile, meaning that the data stored in RAM will be lost if
power is lost.

▪ A battery backup is required to avoid losing data in the event of a


power loss

ME 4210 – Analog and Digital Electronics 46


ROM
▪ Read Only Memory (ROM) is a type of memory that data can be read from
but not written to.

▪ This type of memory is used to protect data or programs from accidental


erasure.

▪ ROM memory is non-volatile. This means a user program will not lose
data during a loss of electrical power.

▪ ROM is normally used to store the programs that define the capabilities
of the PLC.

ME 4210 – Analog and Digital Electronics 47


EPROM

▪ Erasable Programmable Read Only Memory (EPROM) provides some level of


security against unauthorized or unwanted changes in a program.

▪ EPROMs are designed so that data stored in them can be read, but not
easily altered.

▪ Changing EPROM data requires a special effort.

▪ UVEPROMs (ultraviolet erasable programmable read only memory) can only be


erased with an ultraviolet light.

▪ EEPROM (electronically erasable programmable read only memory), can only be


erased electronically

ME 4210 – Analog and Digital Electronics 48


Memory

A super capacitor, so named because of its ability to maintain a charge for a long
period of time, protects data stored in RAM in the event of a power loss. The RAM
memory is typically backed up on the S7-221 and 222 for 50 hours, and on the S7-
224 and 226 for 190 hours.

ME 4210 – Analog and Digital Electronics 49


Memory
Program Space

• stores the ladder logic (LAD) or statement list (STL) program instructions.
This area of memory controls the way data space and I/O points are used. LAD or
STL instructions are written using a programming device such as a PC, then
loaded into program memory of the PLC.

Data Space

• Used as a working area, and includes memory locations for calculations,


temporary storage of intermediate results and constants. Data space includes
memory locations for devices such as timers, counters, high-speed counters,
and analog inputs and outputs. Data space can be accessed under program
control.

Configurable Space

• stores either the default or modified configuration parameters.


ME 4210 – Analog and Digital Electronics 50
Operating System

ME 4210 – Analog and Digital Electronics 51


Operating System

ME 4210 – Analog and Digital Electronics 52


8
User Program Execution

ME 4210 – Analog and Digital Electronics 53


Input Scan

ME 4210 – Analog and Digital Electronics 54


User Program Scan

ME 4210 – Analog and Digital Electronics 55


Output Scan

ME 4210 – Analog and Digital Electronics 56


PLC Operation

PLC performs the following operations repeatedly,


▪ Read the states of the input devices and copy into the RAM memory

▪ CPU execute the program

▪ Write the states of the output devices to output RAM area and then copy
to output module at the end of execution cycle

ME 4210 – Analog and Digital Electronics 57


Ladder Logic Programming

ME 4210 – Analog and Digital Electronics 58


Outline

▪ Input/ Output Addresses

▪ Concepts of Ladder programming

▪ Interlocking

▪ Examples

ME 4210 – Analog and Digital Electronics 59


Input/ Output & Internal Relay Addresses

Data Types:
• Bit data
• Byte data = 8-bit
• Word data = 16-bit
• Double Word data = 32-bit

ME 4210 – Analog and Digital Electronics 60


Input/ Output & Internal Relay Addresses

Data memory areas:


• Input Memory Area (X)
• Output Memory Area (Y)
• Bit Memory Area (M)
• Timer Memory Area (T)
• Counter Memory Area (C)
• Data Register ( D )

ME 4210 – Analog and Digital Electronics 61


I/O Memory Mapping

Byte Address

X0 Y0

Data Memory Type


X – Discrete Input
Y – Discrete Output

ME 4210 – Analog and Digital Electronics 62


Downloading and Running the PLC Program

▪ Connect PLC with the programming device. (eg: Desktop,

Laptop)

▪ If the PLC is running, STOP plc using the PLC software.

▪ Download program into the PLC using PLC software.

▪ Put PLC back into RUN mode.

ME 4210 – Analog and Digital Electronics 63


Concepts of Programming
(1) Number of contacts for I / Os , timers, counters, etc. is unlimited.

ME 4210 – Analog and Digital Electronics 64


Concepts of Programming
(2)Number of contacts to be connected in series or parallel is
unlimited.

(3)Output coil cannot be directly connected to the left bus line.

ME 4210 – Analog and Digital Electronics 65


Concepts of Programming
(4)All output coils must be connected as the last element in the line.

ME 4210 – Analog and Digital Electronics 66


Concepts of Programming
(5)An output coil number can only be assigned once.

ME 4210 – Analog and Digital Electronics 67


Concepts of Programming
(6)Timer & counter data should be entered at the time of programming.

ME 4210 – Analog and Digital Electronics 68


Concepts of Programming

▪ A Ladder rung is TRUE when it has logic continuity

▪ Logic continuity exists when power flows through the rung from left
to right

▪ The execution of logic events that enable the output to provide


this continuity

ME 4210 – Analog and Digital Electronics 69


Standard Instructions

Contacts (switches/ push buttons/ emergency stop/ limit switches)

Normally Open (NO) Normally Closed (NC)

Coils (relays/ bulbs/ motors/ buzzers)

Normal Output Set Output Reset Output


ME 4210 – Analog and Digital Electronics 70
PLC Mixer Process Control Problem

▪ A mixer motor is used to


automatically stir the liquid when
the temperature and pressure reach
pre-set values.

▪ Alternate manual push button


control for the motor is provided•

▪ The temperature and pressure sensor


switches close their respective
contacts when conditions reach
their pre-set values

ME 4210 – Analog and Digital Electronics 71


Process Control Relay Ladder Diagram

ME 4210 – Analog and Digital Electronics 72


Using a PLC

ME 4210 – Analog and Digital Electronics 73


Ladder Logic Diagrams
▪ Ladder logic (LAD) is one
programming language used with
PLCs.

▪ Ladder logics were originally used


for design and construction of
relay racks•

▪ Ladder logic uses components that


resemble elements used in a line
diagram format to describe hard-
wired control.

ME 4210 – Analog and Digital Electronics 74


PLC Ladder Logic Program

X0 X1 Y0

X2

ME 4210 – Analog and Digital Electronics 75


Interlock circuits

• Interlocks can prohibit outputs from energizing under a certain condition.

ME 4210 – Analog and Digital Electronics 76


Latches

Y0
X0

Y1
X1

X2 Y0

ME 4210 – Analog and Digital Electronics 77


Pulse Inputs (Rising edge & Falling edge)

Rising edge
Rising edge gives single pulse at the time of going ON condition. Storage bit stores the status of
input

Falling edge
Falling edge gives single pulse at the time of going input’s OFF condition which is connected to
it. Storage bit stores the status of input. Output bit stores the status of function performed by the
block.

ME 4210 – Analog and Digital Electronics 78


1

PLC Examples and


Solutions 4

5 6

ME 4210 – Analog and Digital Electronics 79


9
Example 1
PLC Mixer Process Control Problem
▪ A mixer motor is used to
automatically stir the liquid when
the temperature and pressure reach
pre-set values.

▪ Alternate manual push button


control for the motor is provided•

▪ The temperature and pressure sensor


switches close their respective
contacts when conditions reach
their pre-set values

ME 4210 – Analog and Digital Electronics 80


Solution

Input/ Output Mapping Table

Input/ Output Address in the PLC


Temperature Sensor X0
Pressure Sensor X1
Push Button X2

Stir Motor Y0

ME 4210 – Analog and Digital Electronics 81


Solution

Ladder Logic Program

ME 4210 – Analog and Digital Electronics 82


Example 02
1.1) Use a detent (latching) push button to switch on and switch off a lamp

1.2) A lamp should get switched on when Push button 1 & Push button 2 switch buttons
push together

1.3) Modify the above program to switch on the lamp by pressing any of the detent push
buttons

1.4) Modify above to following. When you press,


• Push Button 1- switch on lamp and remain in the state
• Push Button 2- switch off lamp

ME 4210 – Analog and Digital Electronics 83


Solution
2.1

2.2

ME 4210 – Analog and Digital Electronics 84


Solution
2.3

2.4

ME 4210 – Analog and Digital Electronics 85


Example 03
You have two detent buttons to operate a lamp in a staircase.
One button is at the bottom of the staircase and other is at the top of the staircase.
Develop a Ladder program for a plc to achieve the task of switching on/off the lamp
being at either top or the bottom of the staircase.

ME 4210 – Analog and Digital Electronics 86


Solution

Ladder Logic Program

ME 4210 – Analog and Digital Electronics 87


10
Example 04
• An automated conveyor line is used to paint the base layer of a metal objects in an
automobile plant. Objects transferred in the conveyor is to be painted while
transferring on the conveyor to have a uniform paint layer.

• If paint level gets lower than a pre-set value conveyer needs to be stopped.

• If paint level gets lower than a pre-set value or the conveyor is stopped for any
reason, a siren will get activated as an alert to the operator and the conveyor will get
turned off.

• A liquid level sensor is used to sense the paint level & a zero speed sensor(ZSS) is used
to detect the status of the conveyor.

• The full automated system is to be activated using a master switch.

ME 4210 – Analog and Digital Electronics 88


Solution

Input/ Output Mapping Table

Input/ Output Address in the PLC


Master Switch X0
Ink Level Sensor X1
Zero Speed Sensor X2

Conveyer Motor Y0
Alarm Y1

ME 4210 – Analog and Digital Electronics 89


Solution

Ladder Logic Program

ME 4210 – Analog and Digital Electronics 90


Example 05
Design a PLC based system in which two lamps, A and B are controlled in following
manner. When the switch (detent type) is turned on lamp A is lit immediately and, after
10s lamp B is lit. Both lamps are switched off when the switch is open.

ME 4210 – Analog and Digital Electronics 91


Solution
Ladder Logic Program

ME 4210 – Analog and Digital Electronics 92


11
Example 06
Design a PLC based system in which two lamps, A and B are controlled in the following
manner. When the push button 1 is pressed, lamp A will turn on immediately and, after
10s lamp B will turn on.
Both lamps will switch off after pressing push button 2.

ME 4210 – Analog and Digital Electronics 93


Solution
Ladder Logic Program

ME 4210 – Analog and Digital Electronics 94


12
Example 07
• Main motor of a CNC spindle is to be controlled using a single switch(detent).
• A green indicator light will turn on soon after turn on the system.

• Main motor bearing is lubricated using a lubricating pump while at operation.


• In any malfunction happened to the lubrication pump during the operation, an alarm
should get activated.

• After switching off the main motor it takes about 30 seconds to it to slow down.
• Hence Lubrication for main motor bearings is required for 30 s after the supply of the
motor is switched off.

• After 30 s, lubrication pump and green indicator bulb will get turned off.

• You need to add an Emergency Switch to turn off the system in any case during the
operation.
• When the emergency switch is pressed, system cannot be started without releasing it.
ME 4210 – Analog and Digital Electronics 95
Solution

Input/ Output Mapping Table

Input/ Output Address in the PLC


Start Switch X0
Lubrication Flow Sensor X1
Emergency Switch X2

Spindle Motor Y0
Lubrication Pump Y1
Green Indicator Lamp Y2
Alarm Y3

Timer T0

ME 4210 – Analog and Digital Electronics 96


Solution
Ladder Logic Program

ME 4210 – Analog and Digital Electronics 97


ME 4210 – Analog and Digital Electronics 98
Thank You
Madhuka Priyashan
Faculty of Engineering
University of Ruhuna

[email protected]

You might also like