PLC Programming and Applications

Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

Programmable Logic Controllers

Programmable Logic Controllers (PLC)

PLC is a digital electronic device that uses a programmable memory to store instructions
for obtaining logic, sequencing, timing, counting and arithmetic in order to control
machine and processes. The advantage of using PLC is that it is possible to modify a
control system without having the input and output devices rewired and without using
new or modified control valves in order to change the required logic. The only
requirement being that an operator has to key in a different set of instructions. The result
is a flexible system that can be used in control systems that vary quite widely in their
nature and complexity.

PLC is similar to using a computer but has certain features that are specific to their use as
controllers. These are:
1. They are rugged and designed to withstand vibrations, temperature, humidity and
noise.
2. The interfacing for inputs and outputs is inside the controller.
3. They are easily programmed and have an easily understood programming
language. Programming is primary concerned with logic and switching
operations.

PLCs were first conceived in 1968. They are now widely used and extend from self-
contained units for use with around 20 digital inputs/outputs to modular systems that can
be used for large number if inputs/outputs, handle digital or analogue inputs/outputs and
also carry out PID control modes.

Architecture of a PLC is given by the figure below.

Data bus
Address bus
Control bus Program
panel

Input
Clo CPU Memory I/O unit
channels

Output
channels
Architecture of a PLC

1
Programmable Logic Controllers

Ladder Diagrams
PLC is programming in general is conducted by ladder diagrams. Each horizontal line,
i.e. rung of the ladder, represents a line in the program. Some basic logics of writing a
PLC are as follows.

Input normally open contacts

Input normally closed contacts

Inputs in series, logic AND

Inputs in parallel, logic OR

Output Devices

Special Instructions

Ladder Programming of PLC


Following below is example of PLC programming to implement the mentioned
operations

I0.0 O0.0
1.

I0.1 O0.1
2.

I0.0 I0.1 O0.0


3.

I0.0 O0.0
4.

I0.1

2
Programmable Logic Controllers

Setting and Resetting an Output


You can set or reset an output or a flag (a memory used) with inputs so that the output
will remain set until it is reset by some other signal.

Timer
Timers are very useful in automation. A timer circuit is specified by stating the interval to
be timed and the conditions or events that are to start and /or stop the timer. There are
three types of timers available in Ladder programming
1. Pulse Timer
2. On Delay Timer
3. Off Delay Timer

Counter
When it is required to count some event, we can make use of a counter. Counter can be
incremented or decremented according to the way it is programmed. Also a counter can
be used to operate as incrementing and decrementing depending upon the event.

Methodology in using a PLC can be given as follows.

1. Identify the requirements or logical sequences that are going to be handled by a


PLC.
2. Write down or draw the requirements, logics or/and sequences in an
understandable format using state change diagrams, flowcharts or System
Diagrams given by the designer (in some special cases). This may be skipped for
smaller tasks, but essential when that the task becomes large or complicated.
However, it is good practice to conduct this step to avoid unnecessary logical
errors.
3. Draw the necessary tables or maps to illustrate the PLC logic that match with the
requirement, but independent from the language code (ladder, logo or statement
list)
4. Connect the PLC to the system to be controlled and to the computer that PLC is
going to get programmed.
5. Identify the input and output cables that are connected in order to program.
6. Write the PLC program according to 2 using the identified inputs/outputs in 4.
7. Validate the program before the actual run. This may be achieved through a
simulation facilitated in the software or using a virtual model using bulb and
switches.
8. Check the program. Remove the connection from the computer if necessary. It
may be conducted part by part in a large application. Also, when the program is
run for the first time, required safety precautions must be made before hand in
order to avoid any damages due to logical errors.
9. Remove the connection from the computer if that has not been done and use the
PLC for the application.

3
Programmable Logic Controllers

Ex 1: There are two single acting pneumatic cylinders with four limits as shown in the
figure below and it is to be operated as follows.
1. When the switch is on, cylinder 1 start going forward until it touches B.
2. When it touches B, it stops and cylinder 2 starts going forward until it touches D.
3. When it touches D, it stops and cylinder1 starts going backward until it touches A.
4. When it touches A, it stops and cylinder2 starts going backward until it touches C.
5. When it touches C, it stops and cylinder1 starts going forward until it touches B.
6. The cycle gets repeated by going to step 2 again until the switch is off.
7. If the switch is off, while in operation cylinder will stop to its original position
after completing the cycle. D
B

A
C

X1 X2

Cylinder 1 Cylinder 2

Cylinders are in the original position

You have been asked to control the above using a PLC. Explain how you would do it.
Denote the switch by S and considering S and A, B, C and D are inputs and X, and X2 are
outputs (assuming that required electro-pneumatic conversion values are available).

Ex 2: In a manufacturing organization, products are placed on to a base. When a product


is placed near the conveyor belt, it is sensed by an optical sensor (Os). There is a
pneumatic actuator (A0) to push the item to the conveyor belt and the arrangement
is as shown in figure (at the last page). It is required to sort two items using an
inductive sensor (Is) to check whether the item is metallic or non-metallic. If the
item is a metallic, that item is to be pushed by a pneumatic cylinder (A1) and the
item is allowed to fall into a collector (C1). Otherwise, it is to be automatically
fallen to a collector (C2) at the end of the belt. Conveyor belt is moving at
constant velocity and times for an item to move to each sensor are at the table
given below. Time required for the pneumatic cylinder to push an item is 0.3 s
and both pneumatic cylinders are single acting spring operated cylinders. It is
required to do the followings using a Programmable Logic Controller (PLC).
(a) Sense any item placed near the optical sensor (Os) and push the item to move on
to the conveyor belt. However, there should be a requirement not to push if any
item is still at the processing stage.

4
Programmable Logic Controllers

(b) Metallic items are to be pushed by actuator 1 (A1) to the collector (C1), and non-
metallic items are to be collected by the collector (C2) at the end of the belt.

Table Ex.2
Operation Time(s)
Activate A0 0
Near A1 10
End of the belt 15

2.1 Draw a PLC ladder diagram to achieve this.

2.2 Assume that each collector can only take 15 items. When a collector is full, it
is to be indicated by a bulb and stop the conveyor belt by resetting an output
signal Mc that is connected to the motor of the conveyor belt. After empting a
collector manually, operator has to push a switch so that the indicator bulb is
off and Mc is set so that the conveyor belt starts. Considering the bulbs and
switches for collector C1 and C2 respectively as B1, B2 and SW1 and SW2,
draw a PLC ladder diagram to achieve the given conditions

C1
Os
IS

A0
C2

item
A1

A0 A1

C2
IS

C1

Fig2:Two views of the system

5
Programmable Logic Controllers

Ex.3: It is required to inspect the length of a product (take a bar from example) to check
whether it is between the tolerance limit or not. It is required to automate this
inspection system. The product is handled in a conveyor belt and three proximity
switches are used as shown in the diagram. These switches are stationary while the
product is moving with the conveyor belt. The requirement is to have the length
larger or equal to AB and smaller than AC. In other words, the distances between
switches A and B is equal to the minimum length acceptable and the distance
between switches A and c is just less than the maximum length acceptable. Taking
the signal of the switches, it is required to find the products of which has the length
within tolerance limits and unsuitable products should be removed from the
conveyor belt by the use of a pneumatic actuator (single acting with a spring
return). Assume that time delay of 1s is required after the decision is made whether
the length is acceptable or not and the time duration required for the pneumatic
actuator to operate is 0.3s. Write a ladder program taking A, B and C proximity
switches as inputs and signal to the actuator as the output to the PLC. Assume that
the next product enters after the current product passes the actuator to avoid
unnecessary complications in programming. State the function of each symbol you
have used in programming.

(Hint- Take input is 1 if the product is at the proximity switch and 0 otherwise. Take the
output as 1 if the signal should be given to the actuator)

Pneumatic
Actuator
Product

B A
C

Fig 3: Conveyor Systems

Ex 4: In a manufacturing organization, products are placed in to a stack one by one as


shown in Fig. 4. Stack of products are raised by a hydraulic actuator (HA) and it is
operated with two control pneumatic signals. When the up signal is on, HA goes up and
when the down signal is on it goes down and for safety reasons, both should not work at
the same time and such condition is warned by a bulb (WB). HA is stopped if no signals
are given to the system. On the base, product is stamped by a pneumatic actuator (A1)
three times (thrice) and thereafter pushed by another pneumatic actuator (A2). Pneumatic
actuators are spring-loaded and they should be operated as follows.

6
Programmable Logic Controllers

(a) Give a signal of 0.5 sec for supply of pneumatic pressure for the actuator
A1 to activate and 0.4 sec for the actuator A1 to go back to its original
position and rest between operations.
(b) Once A1 is at rest after three stamping operations, A2 is used to push the
item from the base. A2 requires 0.3 sec supply of pneumatics for actuating
time for pushing operations.
(c) Once the item is pushed the hydraulic actuator will raise the stack, until
the next item comes to the base. When the item is sensed by the photo sensor
(PS), the hydraulic cylinder stops.
(d) The warning bulb (WB) should be on if both signals to HA is on.

A1

A2 photo
sensor(PS)
base

stack of items

hydraulic
actuator (HA)
Fig.4: The stamping system

It is required to automate the above system using a PLC so that this is repeated until the
stack of items is empty. When the stack is empty hydraulic actuator is at the utmost
position and it is indicated by a limit switch (LS1) that is not shown in the diagram which
is in built with the hydraulic actuator. Once all the items are finished in the stack, HA
should come down at which built in limit switch LS2 will be on. Then an operator has to
fill the stack and push a push button (PB) for the system to be in operation once again

Write all steps related to the above given problem and design the PLC program using the
S7 version to achieve this assuming that inputs and outputs are connected as in the table
given below

7
Programmable Logic Controllers

Inputs Outputs
Starting switch I0.0 WB Q0.0
PS I0.1 A1 Q0.1
LS1 I0.2 A2 Q0.2
LS2 I0.3 HA (up) Q0.3
PB I0.4 HA(down) Q0.4

You can use the following counters and timers as you wish.

On Delay Timer Off Delay Timer


TXX TXX

IN TON IN TOF
Q Q
PT ET PT ET

Table for timers (TON and TOF non retentive) (You cannot use the same timer for TON
and TOF at the same time)

Timer Number (TXX) Resolution Maximum Value (sec)


T32, T96 1 ms 32.767
T33-T36, T97-T100 10 ms 327.67
T37-T63, T101-T255 100 ms 3276.7

Up Counter Down Counter Up/Down Counter

CXX CXX CXX


CU CTU CD CTD CU CTUD

R LD CD

PV PV R

PV
Counter number CXX can be used from C0 to C255 and cannot exceed values 32,767 or
–32,767. You cannot use the same counter for two

You might also like