Unit IV
PLC Programming
Contents
Introduction to PLC
Architecture of PLC
Selection of PLC
Ladder Logic Programming for different gates
Latching
Timers
Counters
Practical Example of PLC
Introduction
PLC is digital computer for automation of Electromechanical Industry
E.g. Assembly Lines
Heating, Ventilation and Air conditioning
Plastic Injection Moulding Machines
Domestic & Commercial Washing Machine
PLC: Member of Computer Family
PLC: Uses IC instead of electromechanical devices to implement control
functions
Introduction
Capable of storing instructions
Timing
Counting
Arithmetic logic
Data Manipulation
Communication
To control machines & Processes
Introduction
Introduction: Why PLC?
Hard wired panels/ Relay logic are time consuming
Hard wired panels : Wiring and Repairing are main issues
Controllers: Faster
Operates in real time
Withstands vibrations, temperature, humidity, noise
Inbuilt interfacing input and output
Flexible, easy to reprogramme
Easy to maintain, less space, less wiring, cheaper
Selection criterion for PLC
Application Requirement
Input / Output Requirement
Memory Requirement
CPU Requirement
Software Requirement
Operate interface
Communication requirement
Environmental Requirements
Components of PLC
Input Devices
Provides input to control system
Limit Switches: Open or Closed
Comparators
Push Buttons: Pressed or Not Pressed
Output Devices
Accept Output from the control system
Lights: ON/ OFF
Motors: Rotating or Non Rotating
Solenoids: Engaged or Not Engaged
Input Output Devices
Input Output
Relay Sequencers
Control, Sequencing, Safety, Central Locks in Automobiles
Before PLC: Relays, Cams, Timers etc.
Physical relays used in circuit instead of Ladder Diagram
Event sequence is done through wires, relays and circuits
For changing Event sequence rewiring requires
Sometimes it is necessary to add or remove relays
Video
From Relay to Computer Based
Controllers
Input and output variables are binary in nature
Control relays can be replaced by Software
Less hardware control
Program sequence can be changed through software only
Special Functions e.g. time delay, counters are easy to change through
software
Architecture of PLC
Components of PLC
Input Module
Output Module
CPU
Memory
Power Supply
Programming Device
Communication
Channel
Input Module of PLC
Module Examines state of physical switches
Other Input Devices
Conversion of signal into form suitable to processor
It can accommodate number of input channels
Input Module of PLC
Conversion of real world voltage & current that PLC can understand
Different types of input devices hence different types of input modules
Digital Module, analog module
Discrete / Digital Module: Use 0 or 1 to show state
Analog Module: Use Number to show state e.g. 30 Degrees
Output Module of PLC
Output Module supplies AC Power to devices like Motors, Lights,
Solenoids
It accepts 0 or 1 from the processor and uses it to turn ON or OFF Motors,
Lights, etc.
Output module channel has indicator to show ON/OFF of operations
Processor
Processor is computer
It executes a program to perform operations given in the ladder diagram
Performs arithmetic and Logical operations
Output given by the processor depends on input variable data
CPU
Brain of PLC
Logic and Sequencing functions
Uses Microprocessor
Memory
Contains Program of logic, sequencing, other input and Output operations
Memory ranges from 1K to 48K words
RAM, ROM, EPROM (Erasable & Programmable)
Power Supply
115 Volts Power Supply for PLC and Other modules
Types
Fits into one slot of chassis
External power supply- outside of the chassis
Stand alone supply- Connected to PLC or Input/Output through power
cable
Embedded power supply as part of PLC Block
Programmable Device
Detachable from the PLC
Can be shared with different controllers
Types
Simple teach Pendant type devices
PLC Programming keyboards and CRT Displays
Communication Channel
Buses: Paths used for communication within PLC
Information is transmitted in binary form
Data Bus: Sending data between constituent elements
Address Bus: To send addresses of locations for accessing stored data
Control Bus: For signal related to internal control actions
System Bus: Communications between the I/P O/P ports & I/P O/P unit
Communication Channel
Types of PLC
Single Box Type (Brick)
For Small Programmable controllers
Internal compact package with power supply, processor, memory
6, 8, 12 or 24 Inputs & 4, 8 or 16 outputs
Stores memory from 300 to 1000 instructions
Types of PLC
Modular (Rack)
Separate module for Power Supply, Memory, Input / Output module,
Processor
Types of PLC
Brick Type PLC
Rack Type PLC
PLC Operation
Two modes of operation
The I/O Scan Mode
The Execution Mode
PLC Operation
The I/O Scan mode
Processor updates state of all outputs and inputs
One channel at a time is scanned
Time required for this depends upon speed of processor
PLC Operation
The Execution mode
Processor evaluates each rung of ladder diagram sequentially
After evaluation of Rung, last known state of each switch & relay contact is
considered
If any true path to the output device is detected then O/P is said to be
energized (It is set to ON)
Use of NC Push Button
(a) Wrong: Button turns light OFF
(b) With Relay logic: Light turns ON
(c) With PLC: Button turns light ON
Programming of PLC
Ladder Logic used for Machine Control and Process Control
Ladder: Resemble Ladder
Vertical Rails are Power Supply
Horizontal Lines are Rungs
Ladder Diagram Scanning
Ladder Diagram: Rung
Elements of Ladder Diagram
Elements of Ladder Diagram
Ladder Diagram: AND Logic
Lamp will be ON only if contact A & B simultaneously actuated
Ladder Diagram: OR Logic
Lamp will be ON only if either of the contact A & or contact B actuated
Ladder Diagram: NOT Logic
Lamp will be ON if contact A is not actuated
Lamp will be OFF when contact A is actuated
Ladder Diagram for AND Gate
Ladder Diagram for OR Gate
Ladder Diagram for NOT Gate
Latch to turn ON & OFF a motor
using 2 NO Push button Switches
Example
Bank with Three Bank Officers having three unique key of vault
Bank Rule: To open the vault at least two officers must be present
Develop the ladder diagram to unlatch the door and turn ON the light when two
keys are inserted
Solution:
1,2,3: Officers’ Key
Example
Small House with 3 Windows and 2 doors
Develop ladder diagram to turn on a light
if one or more windows are open or if both doors are open
PLC Timer Function
To provide needed delays in the PLC applications
To specify period of time that some operation is to last
Timer is activated by true path
Timer begins to accumulate time in form of “ticks”
Each tick is certain amount of time
Timers are preloaded with certain no of ticks
When accumulated time ticks = preload value; timer itself becomes true
PLC Timer Function
EN =Enabled
DN =Done
Timer =T: 1
Time Base =Each count means
0.01 seconds
Preset =0.01 s x 500 = 5 s
Accumulator =Holds the value of
current count
Example: Traffic Light
Red Light on for 31 seconds, Green light on for 28 seconds, amber light is on
for 6 seconds.
PLC Counter Function
Counter counts input changes from False to True
In one scan Input is False
In next scan Input is True
No further count takes place until input goes False again
Counter has preset number of counts
After accumulating preset number of counts counter becomes TRUE
After becoming TRUE it actuates some other part of the Ladder Diagram
PLC Counter Function
EN =Enabled
DN =Done
Counter =C: 1
Preset =Counter gets to
preset value makes DN bit go
TRUE
Accumulator =Holds the value of
current count
SCADA
Supervisory Control and Data Acquisition
Industrial control system
Monitors and Controls industrial processes
Manufacturing,
Production
Power Generation
Fabrication
Refining
Continuous, Batch, Repetitive, Discrete
Components of SCADA
Human Machine Interface (HMI)
Operator monitors and controls the process
Supervisory system (Computer)
Acquires Data of the process
Sends command to process
RTU (Remote Terminal Units)
Connects sensors to Process
Converts Sensor Signal to Digital Data
Sending Digital Data to Supervisory System
PLC: Economical, Versatile, Flexible
Components of SCADA
• RTU: Remote Terminal Unit
• MTU: Master Terminal Unit
• DAS: Data Acquisition
System
• HMI: Human Machine
Interface
Components of SCADA
PLC Examples
Draw a PLC ladder diagram for a motor with:
NO start button
NC stop button
Thermal overload limit switch opens on high temperature
Green light while running
Red light for thermal overload.
PLC Examples Level Control
A process tank (Figure) to mix the liquid fertilizer:
A start pushbutton to start the operation
Valve V1 to fill the tank to preset level sensed by level switch A
As tank fills level switch closes and NO contact energize stirrer motor to
start automatically and operate it for 5 sec to mix the fluid
When stirrer stops valve V2 is energized to empty the tank.
When tank is empty switch B is opened and de-energized valve V2
A stop button to stop the operation
A start pushbutton to start the operation
Valve V1 to fill the tank to preset level sensed by level switch A
As tank fills level switch closes and NO contact energize stirrer motor to start
automatically and operate it for 5 sec to mix the fluid
When stirrer stops valve V2 is energized to empty the tank.
When tank is empty switch B is opened and de-energized valve V2
A stop button to stop the operation
P1 P2 CR 1
CR 1
CR 1 LA V1
CR 1 LA T:1
Time base 0.01
Preset 500
Accum 00
T1 M
T1 LB P2
P2
P2 V2
PLC Examples Conveyor
Start Push Button to start the conveyor motor
Bottles move past the photosensor & conveyor motor automatically after
the count of 25 Bottles
Counter to be set at zero after 25 counts
Conveyor motor can be stopped manually at any time
Count of the counter is reset manually by means of count reset button
Start Push Button to start the conveyor motor
Bottles move past the photosensor & conveyor motor automatically after the count of
25 Bottles
Counter to be set at zero after 25 counts
Conveyor motor can be stopped manually at any time
Count of the counter is reset manually by means of count reset button
X100 Reset Resetting counter
X200 Sensor
X300 Start
X400 Stop
C100 Counter Counter Value 25
M100 Relay
M200 Relay Start Stop, Relay with
Y100 Motor counter
Motor Start
Resetting Relay
(Rung 1)