0% found this document useful (0 votes)
33 views

Ia Module 4 PLC Notes

Uploaded by

anamayank111
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)
33 views

Ia Module 4 PLC Notes

Uploaded by

anamayank111
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/ 24

Industrial Automa0on – Module IV

INDUSTRIAL AUTOMATION
COURSE CODE: 5042 (REV 2021)
PROGRAMMABLE LOGIC CONTROLLER
MODULE IV NOTES

1
Industrial Automa0on – Module IV

Introduction to PLC (Programmable Logic Controller)


Programmable logic controllers are microcomputers (computer based) that perform control
functions in a variety of processing plant and factory environments. This was originally intended as
replacement equipment for relays in automotive industries. Now PLCs are important part of
automation equipment in many industries. PLCs are similar to computers, but they are designed for
control and industrial applications.
A Programmable Logic Controller (PLC) is an industrial computer control system that
continuously monitors the state of input devices and makes decisions based upon a program
to control the state of output devices.
A PLC produces ON/OFF voltage outputs and can actuate elements such as electric motors,
solenoids (and thus pneumatic and hydraulic valves), fans, heaters and light switches.

Some PLC manufacturers


Allen Bradley
ABB
Siemens
Hitachi
Mitsubishi
General Electric (GE)
Honeywell

Architecture of PLC

GPC Mattannur 2
Industrial Automa0on – Module IV

A PLC architecture consists of the following main units:


1. Power supply
It provides the isolation necessary to protect the solid state components from high voltage
spikes. It converts power line voltages to those required by the solid state components. It is rated
for heat dissipation requirements for plant operations. It drives other units of PLC such as I/O
unit, CPU, memory unit and peripheral devices.
2. Input/Output (I/O) system
Inputs are defined as the real world signals giving the controller, the status of the process.
They can be analog or digital or having high or low frequency. Signals from thermocouples and
RTDs (Resistance Temperature Detectors) are common examples of analog signals. Push
buttons, relay contacts etc can give digital inputs.
Input module is used to interface between the input device to CPU. The function of this interface
is to receive and convert field signals (push button, limit switch, proximity switch , circuit breaker,
relay etc.) into a form that can be used by the CPU.
Output module is used to interface between CPU and output device. The output interface performs
the opposite function of the input interface. It connects CPU to several output devices like solenoid
valves, lamp box, panel meters and displays or motor speed drives.
3. Central Processing Unit
It is also called the central control unit. It performs tasks necessary to fulfil the PLC function
such as scanning, I/O bus traffic control, program execution, external device communication and
self diagnostics.
4. Memory Unit
It is the unit where the program containing the control actions to be exercised by the
processor is stored. The data from input modules and the data for output modules are also
temporarily stored in the memory unit
5. Programmer Unit
It provides an interface between the PLC and user during the program development, start up
and trouble shooting. The instructions to be performed during each scan are coded and inserted
into the memory with the programmer unit. It can be small hand held units (size of a large
calculator) to desktop standalone units. Nowadays computers are used which can be interfaced
with the PLC using a serial module. Programming can be done offline (programming unit not
connected to the PLC while editing) or online (editing of program while the PLC is working)

GPC Mattannur 3
Industrial Automa0on – Module IV

6. Peripheral devices
They are divided into several categories like programming aids, operational aids, I/O
enhancements and computer interface devices.
Programming aids provide documentation and program recording capabilities- can be done
using PC compatible software.
Operational aids include variety of resources like color graphics CRTs or other equipment
which can be used to monitor specific process variables
I/O enhancement group are special hardware modules that can be plugged into the PLC, which
provides intelligence and remote I/O capabilities.
Computer interface group provides PLC to PLC communication or network interaction with
various computer systems.

Modes of operation of PLC


There are two modes of operation in a Programmable Logic Controller. One is the I/O scan
mode and the other is the execution mode
I/O Scan Mode
This consists of Input scan and output scan
During Input Scan, the input channels are scanned one
at a time (not all the channels together)
The processor looks at each input channel to see if it
is ON or OFF
The information from the input channels is stored in a
data table inside the processor for use in the next step
Based on the inputs scanned and program execution,
output values are stored in a temporary memory inside
processor.
During output scan, outputs are updated using temporary values stored in the memory
Execution Mode
This mode evaluates each rung of the ladder diagram program
The execution is sequential, which means, it happens one after another. It begins from the
first rung and ends at the last rung.
Execution is done using the memory copy of inputs (Stored in the data table during input
scan)
Based on the execution of program, the outputs are either energized or de-energized
This process repeats: Input Scan → Execution → Output Scan

GPC Mattannur 4
Industrial Automa0on – Module IV

Advantages of PLCs
1. Ease of programming and reprogramming in the plant
2. A programming language that is based on relay wiring symbols familiar to most plant
electric personnel.
3. High reliability and minimum maintenance
4. Ability to communicate with computer systems in the plant
5. Moderate to low initial investment cost
6. Rugged construction
7. Modular design

Applications of PLCs
1. They are used in glass manufacturing, for controlling the material ratio
2. They are used to control machines used for paper manufacturing
3. They are used to mix raw materials in the correct quantity, in cement manufacturing industry
4. They are used to control the wind turbines
5. They are used in boilers in thermal power plants
6. In process automation plants (mining, oil and gas)

GPC Mattannur 5
Industrial Automa0on – Module IV

PLC Ladder Programming


Ladder logic is a programming language that is used to program a PLC. It is a graphical
PLC programming language which expresses logic operations with symbolic notation using
ladder diagrams.
Writing a program is equivalent to drawing a switching circuit. Ladder logic was originally
designed to replace the use of hard wired relay logic circuits for machine control. The ladder
logic programming code actual looks like an electrical schematic drawing.
The diagram looks like a ladder. The vertical lines are
for power supply and are known as vertical rails.
The rails in a ladder diagram represent the supply
wires of a relay logic control circuit. There is a positive
voltage supply rail on the left hand side and a zero
voltage rail on the right hand side.
The horizontal lines are known as rung. Each rung on
the ladder defines one operation in the control
process. The processor scans the ladder rungs from top
to bottom and left to right.
The inputs are arranged on the left side and outputs are
arranged on the right side of the ladder diagram.
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.
Inputs – The inputs are external control actions such as a push button being pressed or a
limit switch being triggered. The inputs are actually hardwired to the PLC terminals and
represented in the ladder diagram by a normally open (NO) or normally closed (NC) contact
symbol.
Outputs – The outputs are external devices that being are turned on and off such as an
electric motor or a solenoid valve. The outputs are also hardwired to the PLC terminals and
are represented in the ladder diagram by a relay coil symbol.
Logic Expressions – The logic expressions are used in combination with the inputs and
outputs to formulate the desired control operations
Address Notation & Tag Names – The address notation describes the input, output and
logic expression or memory addressing structure of the PLC. The tag names are the
descriptions allocated to the addresses.

GPC Mattannur 6
Industrial Automa0on – Module IV

Comments –Comments are displayed at the start of each rung and are used to describe the
logical expressions and control operations that the rung, or groups of rungs, are executing.
Understanding ladder diagrams is made a lot easier by using comments.
Electrical devices are shown in their normal condition. Thus a switch, which 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. 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 depending on
the PLC manufacturer. This is the address of the input or output in the memory of the PLC.
When the PLC is in its run mode, it goes through the entire ladder program to the end, the
end rung of the program being clearly denoted, and then promptly resumes at the start.

Basic Ladder logic symbols

GPC Mattannur 7
Industrial Automa0on – Module IV

Examples
Ladder logic to switch a bulb ON/OFF
In the ladder logic diagram we can see there is an input contact (N-O) “I0.0” which is a toggle
switch in the physical connections to the plc. There is also an output coil addressed as “Q0.0” which
can be a Motor, Bulb or any signaling device in the physical connection.

Now, as soon as toggle switch is pressed the NO contact


of I0.0 becomes NC and the corresponding rung logic
goes true. As a result output coil Q0.0 gets energized and
the bulb will ON.

Logic gates implementation using ladder diagram


1. NOT GATE
NOT gate works as inversion. It takes one input and gives one output. When the input is high then
the output is low and vice-versa.

2. AND GATE
In AND Gate, when both inputs (I1 and I2) are high then the output (Q1) will be high. For all other
inputs, output (Q1) will be the low.

connecting two
s output. In the
lamp (Q1) will
2) are open then

Q1= I1 . I2

GPC Mattannur 8
Industrial Automa0on – Module IV

3. OR GATE
Working: If both inputs are low in the OR gate, then the output will be low. For all other cases, the
output will be high.

In case both or anyone inputs (I1 and I2) are closed then coil (Q1) will on.

Q1=I1+I2

4. NAND GATE
NAND gate is operated as an AND gate and followed by the inverter. In NAND Gate, the output
will be low when both inputs are high. For all other
cases, the output will be high.

If both switches (I1 and I2) or anyone switch (I1 or I2) are closed, the lamp will be glow. In the
case, both switches are open then the lamp will not be glow.

5. NOR GATE
NOR Gate is operated OR Gate followed by the NOT
Gate. When both inputs are low then the output will be
high.

The Coil (Q1) will be activated if both inputs are closed. Coil (Q1) will be deactivated if any one

GPC Mattannur 10
Industrial Automa0on – Module IV

or both the inputs are open.

6. EX-OR GATE
Working: If both inputs are same, the output will become low. For any other input condition, the
output will be high.

7. EX-NOR GATE
Working: When both inputs (I1 and I2) are same then the output will high.

GPC Mattannur 11
Industrial Automa0on – Module IV

Half-Adder
A half adder can add two binary bits A and B. It has two outputs. One is sum and the other is carry.
The expression for sum is same as the EXOR gate expression and that of carry is same as AND
gate. The expressions are as given:

Half subtractor
This circuit is used to subtract one binary bit from another. There are two inputs A and B
and there are two outputs. One output is the difference and the other one is borrow. The expressions
are as given:

GPC Mattannur 12
Industrial Automa0on – Module IV

INSTRUCTIONS IN LADDER DIAGRAM


Math Instructions in PLC ladder diagram
The important arithmetic instructions used in the ladder diagram are discussed here:
There are three parameters in each block,
Source A –Address of the first Value
Source B –Address of the second value
Destination (Dest) – Address where result of the function will store.

ADD:

Add block is used to do the Addition of the two values stored


in source A and source B and store the output in destination
address. Values stored in N7:0 and N7:1 gets added and
result is stored in N7:3.

SUB:
SUB block is used to do the Subtraction of the two values
stored in source A and source B and store the output in
destination address. Value stored in N7:1 is subtracted from
the value stored in N7:0 and result is stored in N7:3.

GPC Mattannur 13
Industrial Automa0on – Module IV

MUL:

MUL block is used to do the Multiplication of the two values


stored in source A and source B and store the output in
destination address. Values stored in N7:0 and N7:1 gets
multiplied and result is stored in N7:3.

DIV:
DIV block is used to do the Division of the two values stored in
source A and source B and store the output in destination address.
Value stored in N7:0 is divided by the value stored in N7:1 and result
is stored in the destination address.

SQR

SQR block is used to find the square root of the value stored
in source address and results the value in destination address.
The number whose square root is to be found is to be stored
in N7:0. The result of operation will be available at the
destination address N7:1.

NEQ:
NEQ block is used to negate the value stored in source
address and results the value in destination. The value
which is to be negated can be stored in N7:0. Result will be
available at the destination address N7:1.

GPC Mattannur 14
Industrial Automa0on – Module IV

Compare Instructions in PLC ladder diagram


Comparison instructions in PLC are used to test pairs of values to condition the logical continuity
of a rung. The important comparison instructions used in the ladder diagram are discussed here:

Equal (EQU) Instruction


The EQU instruction is used to test whether two values
are equal. If source A and source B are equal, the
instruction is logically true. If these values are not equal,
the instruction is logically false.
Source A must be an address.
Source B can be either a program constant or an address.

Not Equal (NEQ) Instruction

The NEQ instruction can be used to test whether


two values are not equal. If source A and source B
are not equal, the instruction is logically true.
Source A must be an address. Source B can be
either a program constant or an address.

GPC Mattannur 15
Industrial Automa0on – Module IV

Less Than (LES) Instruction


The LES instruction can be used to test whether one value
(source A) is less than another (source B). If source A is less
than the value at source B, the instruction is logically true.
Source A must be an address. Source B can be either a
program constant or an address.

Less Than or Equal (LEQ) Instruction


The LEQ instruc0on can be used to test whether one value
(source A) is less than or equal to another (source B). If the
value at source A is less than or equal to the value at source
B, the instruc0on is logically true.
Source A must be an address.
Source B can be either a program constant or an address.

Greater Than (GRT) Instruction

The GRT instruction can be used to test whether one value


(source A) is greater than another (source B).
If the value at source A is greater than the value at source B, the
instruction is logically true.

Greater Than Or Equal (GEQ) Instruction

The GEQ instruction can be used to test whether one value (source
A) is greater than or equal to another (source B).
If the value at source A is greater than or equal to the value at source
B, the instruction is logically true.

GPC Mattannur 16
Industrial Automa0on – Module IV

Masked Comparison for Equal (MEQ)

The MEQ instruction can be used to compare data at a source address


with data at a compare address. The Use of this instruction allows
portions of the data to be masked by a separate word. Source is the
address of the value you want to compare. Mask is the address of the
mask through which the instruction moves data.

Limit Test (LIM) Instruction

The LIM instruction can be used to test for values within or outside a
specified range, depending on how you set the limits.

GPC Mattannur 17
Industrial Automa0on – Module IV

Timer instructions in PLC ladder diagram


A timer is a PLC instruction measuring the amount of time elapsed following an event. Timer
instructions come in two types: on-delay timers and off-delay timers. Both “on-delay” and “off-delay”
timer instructions have single inputs triggering the timer function.
ON Delay Timer
In the On-delay timer instruction, there are totally four
parameters.
TIMER: T4:0 – Timer File name (Timer T4:0, T4:1,
T4:2…)
TIMER BASE – Decides how the timer needs to
count, in Seconds, Milli Seconds…
PRESET – Decides until what time should the timer run.
ACCUMULATOR – Running Value of timer when it is in ON condition.
There are 3 bits associated with On delay timer:
EN: This bit goes high when the timer is energized.
TT: This bit will be high when the timer’s running is in progress.
DN: This bit goes high when the timer has finished running.

TON timer example

GPC Mattannur 18
Industrial Automa0on – Module IV

The operation of the program can be summarized as follows:


 The timer is activated by input switch A.
 When input switch A is closed (true or set to 1), the processor starts timer T4:0 timing and sets
the EN and TT bits to true or 1.
 This turns ON outputs B and C
 The accumulated value increases in one-second time base intervals.
 When the accumulated time equals the preset time (10 s), the DN bit is set to 1, output D is
turned ON, the TT bit is reset to 0 and output C is turned OFF.
 As long as input switch A remains closed the EN bit is set to 1 and output B will be ON.
 If input switch A is opened at any time before or after the timer has timed out, the accumulated
time is automatically reset to 0 and output B is turned OFF.
 This timer configuration is termed no retentive because any loss of continuity to the timer
causes the timer instruction to reset

OFF Delay timer

Timer OFF delay block is used to delay the turning


OFF of any output. Example-Setting timer to turn off
Induction Stove, TV remote settings to turn OFF TV
after certain time. In the OFF-delay timer instruction,
there are totally four parameters.
TIMER: T4:0 – Timer File name (Timer T4:0, T4:1, T4:2…)
TIMER BASE – Decides how the timer needs to count, in Seconds, Milli Seconds…
PRESET – Decides until what time should the timer run.
ACCUMULATOR – Running Value of timer when it is in ON condition.
There are 3 bits associated with On delay timer:
EN: This bit goes high when the timer is energized, TT: This bit will be high when the timer’s
running is in progress.
DN: This bit will be high when the timer is running and it goes low once the timer has finished running.
TOF TIMER EXAMPLE

GPC Mattannur 19
Industrial Automa0on – Module IV

 When the switch connected to input(S1) I:1/0 is first closed, timed output O:2/1 is set to 1
immediately and the lamp is switched on.
 If this switch is now opened, logic continuity is lost and the timer begins counting.
 After 15 s, when the accumulated time equals the preset time, the output is reset to 0 and the lamp
switches off.

Counter instructions in PLC ladder diagram


Counters are used to count the number of occurrences of an event. Counter can be an up counter
that counts up or a down counter that counts down.
Up Counter

In the above picture, there are three parameters


COUNTER: C5:0 – Counter File name (Counter C5:0,
C5:1, C5:2…)
PRESET –PRE: Limit value of COUNT-Up to how
much it should count.
ACCUMULATOR –ACC: it shows the status of counting.
From the data file, along with preset and accumulator, some other bits are also there:
CU: Count up Bit-whenever the counter is enabled this bit goes high
DN: Done Bit-When accumulator value reaches preset value, done bit goes high.
OV: Over Flow Bit-When accumulator value reaches the limit value (32767), it rolls back to-32767
for the upcoming counter operation. Overflow bit turns ON, when this condition occurs.

Up counter example

GPC Mattannur 20
Industrial Automa0on – Module IV

The operation of the program can be summarized as follows:


• Operating pushbutton PB1 provides the off-to-on transition pulses that are counted by the
counter.
• The preset value of the counter is set for 7.
• Each false-to-true transition of rung 1 increases the counter’s accumulated value by 1.
• Output O:2/1 is energized as long as the accumulated value is less than 7.
• After 7 pulses, or counts, when the preset counter value equals the accumulated counter
value, output DN is energized.
• As a result, rung 2 becomes true and energizes output O:2/0 to switch the red pilot light on.
• At the same time, rung 3 becomes false and de energizes output O:2/1 to switch the green
pilot light off.
• The counter is reset by closing pushbutton PB2, which makes rung 4 true and resets the
accumulated count to zero.
• Counting can resume when rung 4 goes false again

Down counter

The down counter block in the PLC ladder diagram


works just like the UP counter. Counter name, Preset
and Accum parameters have the same functions as in
Up counter. The counting starts from the Preset value
and counts down up to 0. CU, D and OV bits has the

same purposes as in the Up counter.


Down counter example

GPC Mattannur 21
Industrial Automa0on – Module IV

• With the program in the state shown, the CTD done bit will be set (1) and output 0:2/0 will be
energized because the accumulated value of 4 is greater than the preset value of 2.
• When the CTD instruction rung makes a false-to-true transition, the accumulated value decreases by
one count to 3.
• When the input rung condition makes another false-to-true transition, the accumulated value will
decreases to 2.
• When the input makes one more false-to true transition, the accumulated value will drop to 1.
• At this point the accumulated value of 1 is less than the preset value of 2 so the done bit will be reset
(0) de-energizing output O:2/0.

Program Control instructions


Program control instructions are used to enable or disable a block of logic program or to move execution
of a program from one place to another place.
The program control commands can be summarized as follows:

JMP (Jump to Label)—Jump forward/backward to a corresponding label instruction.


LBL (Label)—Specifies label location.
JSR (Jump to Subroutine)—Jump to a designated subroutine instruction.
RET (Return from Subroutine)—Exits current subroutine and returns to previous condition
SBR (Subroutine)—Identifies the subroutine program.
MCR (Master Control Reset)—Clears all set no retentive output rungs between the paired MCR
instructions

Master Control Reset Instruction


when the instruction is true, the circuit functions normally, and when the instruction is false, non retentive outputs
are switched off. MCR coil instructions are used in pairs and can be programmed to control an entire circuit or to
control only selected rungs of a circuit. In the program of figure the MCR is programmed to control an entire
circuit.

GPC Mattannur 22
Industrial Automa0on – Module IV

• The section or zone being controlled begins with the first MCR instruction and ends with the second
MCR.
• When the first MCR instruction is false, or disabled, all rungs below it, in this case outputs M and
PL1, will be de-energized even if the programmed logic for each rung is true.
• Assume the motor M is running and the MCR instruction becomes disabled. The motor will
immediately become de-energized and stop operating. When the MCR instruction then become
enabled, the motor will not revert back to its previous
Jump Instruction

In PLC programming it is sometimes desirable to be able to jump over certain program instructions
when certain conditions exist. The jump (JMP) instruction is an output instruction used for this purpose.
When the jump instruction is used, the PLC will not execute the instructions of a rung that is jumped.
• The jump instruction with its associated label instruction (LBL) must have the same address..
• When the jump instruction is true, all logic between the jump and label instructions is bypassed and
the processor continues scanning after the LBL instruction.
 The label instruction must be programmed as the first instruction on the rung where it resides
 The label instruction is always true, and the remaining instructions on the rung must make up a
verifiable rung
The program of figure illustrates the use of a jump instruction

The operation of the program can be summarized as follows:


• When the switch is open the jump instruction is not activated.
• With the switch open, closing PB turns on all three pilot lights.
• When the switch is closed the jump (JMP) instruction will activate.
• With the switch closed, pressing PB turns on pilot lights PL1 and PL3 only.
• Rung 3 is skipped over during the PLC program scan so PL2 will remain in its last state before the

GPC Mattannur 23
Industrial Automa0on – Module IV

JMP was enabled.

Subroutine Functions
A subroutine is a short program that is used by the main program to perform a specific
function. Large programs are often broken into subroutine program files, which are called and executed
from the main program.

When a subroutine is called from the main program, the program is able to escape from the main
program and go to a program subroutine to perform certain functions and then return to the main
program. In situations in which a machine has a portion of its cycle that must be repeated several
times during one machine cycle, the subroutine can save a great deal of duplicate programming. The
sequence of rungs could be programmed one time into a subroutine and just called when needed.
The subroutine instructions can be summarized as follows:
Jump to Subroutine (JSR)—The JSR instruction redirects logic execution from the current ladder file
to the specific subroutine file. When rung conditions are true for this output instruction,
Subroutine (SBR)—The SBR instruction is the first input instruction on the first rung in the subroutine
file. It serves as an identifier that the program file is a subroutine. This file number is used in the JSR
instruction to identify the target to which the program should jump. It is always true, and although its
use is optional, it is still recommended.
Return (RET)—The RET instruction is an output instruction that marks the end of the subroutine file.
It causes the scan to return to the main program at the instruction following the JSR instruction where
it exited the program. The scan returns from the end of the file if there is no RET instruction. The rung
containing the RET instruction may be conditional if this rung precedes the end of the subroutine. In
this way, the processor omits the balance of a subroutine only if its rung condition is true.

GPC Mattannur 24
Industrial Automa0on – Module IV

Real time applications of PLC


1. PLCs are used in manufacturing plants to control and monitor robotic arms, conveyor belts and
various other processes.
2. PLCs automate various industrial processes such as material handling, packaging, labelling,
and quality control.
3. PLCs help manage energy consumption by controlling lighting, heating, ventilation, and air
conditioning
4. PLCs monitor and control water treatment processes, such as filtering, disinfection, and
chemical dosing systems in buildings, leading to energy savings and cost efficiency.
5. PLCs control conveyor systems, robotic pick-and-place operations, and automated guided
vehicles (AGVs) in warehouses and distribution centers.
6. PLCs control lighting, security systems, elevators, and HVAC systems in commercial and
residential buildings, enhancing comfort, security, and energy efficiency.
7. PLCs are essential in pharmaceutical manufacturing, ensuring precise dosing, mixing, and
packaging of medications.
8. PLCs regulate various stages of food production, from mixing and cooking to packaging and
labelling.
9. PLCs control automotive assembly lines, managing tasks like welding, painting, and quality
testing.
10. PLCs manage operations in solar power plants, wind farms, and hydroelectric facilities.

GPC Mattannur 25

You might also like