0% found this document useful (0 votes)
13 views36 pages

Industrial Automation U3 L1

Uploaded by

ogloc798
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)
13 views36 pages

Industrial Automation U3 L1

Uploaded by

ogloc798
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/ 36

PLC Programming

Unit-3

Ojaswi Bahadur Lakhey


What is PLC programming?
• PLC programming is an important activity
that involves planning and developing
programs to implement control
applications based on the desired situation.

• When designing a PLC program, as a


programmer must know the type of PLC PLC programming uses a
programming language to be used. programming language
that is easy to use and
learn by beginner.
Programming Languages
• Generally, at the international level each industry will use a different
PLC programming language based on the type of PLC.
• IEC 1131-3 is a global standard for control programming languages in PLCs.
PLC programming languages are divided into two categories:
• Text languages Te x t L a n g u a g e s G ra p h i c L a n g u a g e s
• Graphic languages. Mnemonic Code
(Instruction List)
Ladder Diagram

G ra p h i c
Languages
Sequential
Function Chart
(SFC)

Te x t L a n g u a g e s G ra p h i c L a n g u a g e s
Structured Text Function Block Diagram
(FBD)
Basic Program Instruction Methods
• A program is a connected series of instructions written in a language
that the PLC can understand.
• There are three forms of program format; instruction, ladder and SFC.
• Not all programming tools can work in all programming forms
Ladder Diagram
• Ladder diagram are a type of programming language that uses graphic
methods to write control instructions.
• It is the most used and best choice language for PLC programming.
• This language is very similar for all PLC manufacturers.
• Ladder Diagram is kind of graphical programming language that
evolved from the the relay control wiring circuit diagram.
+ve -ve
NO NC output
Rung

Power line
Ladder Diagram
• The ladder diagram has vertical lines on the right and left. It
represents for positive (+ve) and negative (-ve) power lines
• The horizontal line that connects the bus bar is called a Rung, and it
is where the switching elements Normally Open (NO), Normally
Closed (NC) and OUTPUT are placed.
+ve -ve
NO NC output
Rung

Power line
Ladder Diagram
Basic Components of Ladder Diagram

Normally Open (NO) Contact


Coil/Output

Normally Closed (NC) Contact

Programmable Logic Controller 7


Ladder Diagram of Logic Gates

Programmable Logic Controller 8


Ladder Diagram
A ladder diagram
consists of a set of rungs
in which each rung
represents a single line
with a specific function.

Programmable Logic Controller 9


Ladder Diagram Features
• Power/ Signal flow is from left to right

Current flow
Left rail

•The output on the right can not be connected directly to the left.
Wrong

There must be at least one input for each rung.


SW1 Lamp
0000 1000
Ladder Diagram Features
• Each rung contains at least one output.

At least
one output

• Each rung contains at least one output.

Wrong

Output must connect to a right rail.

Right rail
Ladder Diagram Features
• Multiple loads cannot be connected in series

Wrong

Multiple loads must be connected in parallel.

Output
connect
in parallel
Ladder Diagram Features
• Each output in the programmed can only be used once and cannot
be repeated.
+ve SW1 SW2 Lamp 1 -ve
0001 0002 1001

Output
Lamp 2
can be
1002
used once

Multiple input can be used in the programmed


+ve SW1 SW1 Lamp 1 -ve
0000 0001 1001

SW1 SW2 Lamp 2


0001 0002 1002
Ladder Diagram Features
• Output address can be used as input address
+ve Lamp 1 SW2 Lamp 2 -ve
1001 0001 1002

Input address cannot be used as an output address.


+ve SW1 SW2 SW3 -ve
0001 0002 0003
Wrong
Example 1:
On/Off push button of a motor
• Program

Connection
Start Push Button

Input
Stop Push Button

Program
Connection

Motor
Output

M
M

Programmable Logic Controller 15


Example 2:
Water Tank
Simple water tank
• Level sensors, wires.
• If water level is less than LDown, NO contact of LDown is opened
• If water level is less than LUp, NO contact LUp is opened
P1 (Pump) Lup
LDown

Programmable Logic Controller 16


Star Delta Starter
Star Delta Starter
Star Delta Starter
Star Delta Starter
Mnemonic Code (Instruction List)
• Mnemonic Code (Instruction List) is a PLC programming language that
uses statement lists.
• It is used to programmed the PLC by entering data and instructions
through the Programming Console.
• A mnemonic code is an instruction keyword, usually an abbreviation
of the actual name of the instruction.
PLC
Basic Instruction Set
• Ladder Diagram → Assembly Code (Instruction Set) → Machine Code.

LD, LDI Load (LD)/Inverted Load (LDI) to accumulator


AND, ANI AND/ANI between accumulator and input
OR, ORI OR/ORI between accumulator and input
OUT Stores accumulator to memory (Value remains in accumulator)

LD X1
OR Y1
AND X2
AND X3
OUT Y1
OUT Y2
LDI X2
OUT Y3
Programmable Logic Controller 22
Mnemonic Code

ADDRESS INSTRUCTION DATA


0000 LD 0001
0001 OR 0002
0002 AND 0003
0003 OUT 1001
0004 TIM 000
#050
0005 FUN (01)
PLC
Basic Instruction Set
ANB Operates on last element in the stack and accumulator and stores
ORB result in accumulator . The last element of stack is removed.

LD X1
OR X2
LD X3
OR X4
ANB
OUT Y1

LDI X2
AND X4
LD X3
AND X5
ORB
OUT Y2
Programmable Logic Controller 24
Grafcet Diagram (Sequential Function Chart/ IEC 848
Standard)
• Graphical technique for writing concurrent control
programs Initial Step
Basic Elements of Grafcet
• Initial step: the first step
• Step: basically a state of operation. A state often has Step Action
an associated action
• Macrostep: a collection of steps (basically a
subroutine)
• Transition: causes a shift between steps, acts as a
point of coordination Step I Transitions
• Flowlines: connects steps and transitions (these Flowlines
basically indicate sequence) Step II

Programmable Logic Controller 25


Grafcet Diagram (Sequential Function Chart/ IEC 848
Standard)
• Selection branch: an OR - only one path is
followed
• Simultaneous branch: an AND - both (or Step I
more) paths are followed

Step II Step III

Step I

Step II Step III

Programmable Logic Controller 26


Elements
Example 1
• On/Off push button of a motor

Motor OFF

Relay OFF

Stop pressed Start pressed

Motor ON

Relay ON

Programmable Logic Controller 28


Example 2:
Water Tank
Initial
Tank filling Tank
Step
do/Pump On 1 Filling
Action
Pump
tank filled tank empty On
Transition LUp
[Lup] [Ldown]
2 Idle
Idle
Pump
do/Pump Off Off
LDown
Step
Statechart for Water Tank

Programmable Logic Controller 29


Example 2:
Water Tank

Tank
1 Filling
Pump
On
LUp

2 Idle
Pump
LDown Off

Programmable Logic Controller 30


Example 3:
Automation of Product Packaging

System OFF

Stop Start

Position New Box


Stop do/Box Convey

Box Positioned
Apple Counter ≥ 10
[Box Sense] & NOT (Stop)
& not (Stop)
Fill Apple
do/Apple Convey;
Apple Count

Programmable Logic Controller 31


Example 3:
Automation of Product Packaging
1 System OFF

Start
Position New Box
2
Box Convey
Box Sense
Stop & NOT
(Stop) Fill Apple
3
Apple Convey;
Apple Count
Stop
Apple Counter ≥ 10
& NOT (Stop)

Programmable Logic Controller 32


Example 4:
Bottle Filling Plant
1. Move the conveyer belt until
bottle is in correct position.
2. Open valve (V) and fill the bottle
until bottle_filled is detected.
3. Repeat from step 1.
Buffer Tank

Valve Control (V)


Level Sensor
bottle_present (BP)
bottle_filled (BF)
Motor (M)

Conveyer belt

Programmable Logic Controller 33


Example 4:
Bottle Filling Plant
Position New Bottle
do/Move Conveyer M→ ON

Bottle Present (BP) Bottle Filled (BF)


Fill Bottle
do/Open Valve V → ON

Programmable Logic Controller 34


Example 4:
Bottle Filling Plant

Position New Bottle


1
Move Conveyer M→ ON

BP
Fill Bottle
2
Open Valve V→ ON

BF

Programmable Logic Controller 35


Example 3 - On/Off parallel control

You might also like