PLC Programming and Applications
PLC Programming and Applications
PLC Programming and Applications
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.
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.
Output Devices
Special Instructions
I0.0 O0.0
1.
I0.1 O0.1
2.
I0.0 O0.0
4.
I0.1
2
Programmable Logic Controllers
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.
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
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).
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.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
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
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.
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)
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