Lecture 6 - PLC - Note
Lecture 6 - PLC - Note
PLC is a digital electronic device that uses a programmable memory to store instructions
for obtaining logic, sequencing, timing, counting and arithmetic 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 ito 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
Palitha Dassanayake 1
Programmable Logic Controllers
Ladder Diagrams
or Output Devices
A special instruction
The sequence followed by a PLC when carrying out a program can be summarized as
follows.
1. Scan the inputs associated with one rung of the ladder program.
2. Solve the logic operations involving these inputs.
3. Set/reset the output for that rung.
4. Move on to the next rung and repeat operations 1,2,3 until the end of the program.
Palitha Dassanayake 2
Programmable Logic Controllers
I0.0 Q0.
1.
0
I0.1 Q0.
2. 1
I0.0 Q0.
0
4.
I0.1
Fig 7
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. In S7 –200,
you can count in step of 1ms,10ms or 100ms depending upon the timer. Timer has two
operands, bit operand and the byte operand. Depending on how it is used, the relevant
one will be accessed automatically by the program.
There are three types of timers available.
1. On-Delay Timer (TON) for timing a single interval
2. Retentive On-Delay Timer (TONR) for accumulating a number of timed intervals
3. Off-Delay Timer (TOF) for extending time past a false condition (in other words,
such as cooling a motor after it is turned off)
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 used (Up counter and down
counter). Also a counter (Up/Down counter) can be used to operate as incrementing and
decrementing depending upon the event.
Palitha Dassanayake 3
Programmable Logic Controllers
The given questions are based on switches and bulbs or can be validated using switches
and bulbs easily. These questions will give you an understanding of basic ladder
programming.
2.0 A bulb is to be on after 20 seconds when a switch is on and bulb is to be off when
the switch is off.
3.0 When a switch is on, a bulb is to be on, and it is to be off after 15 seconds when the
switch is off.
4.0 There are two switches S1 and S2 and a bulb B1. The bulb should be on if and if
Palitha Dassanayake 4
Programmable Logic Controllers
only one switch is on, otherwise it is off (Bulb is off if both switches are on). Add another
bulb B2 to this system so that it is on if and only if S1 and B1 are both on, otherwise it is
off. Draw a truth table for this system and try to obtain the logic for B2 using only inputs
(without using B1 as an input). Validate your answer by rewriting the ladder by only
using switches (S1 and/or S2) to obtain B2.
5.0 Write a PLC ladder diagram to show an incremental counter with two inputs, one
switch S1 to increment the counter, one switch S2 to reset the counter. Take the preset
value as 5 and have one output bulb B1 to be on if the actual count is more or equal to 5.
When the counter is reset, the count should be equal to zero.
Question
There is a waiting room at an organization for the workers to wait to meet the managers.
The room was ventilated by a fan that supplies chilled air and it was being operated
throughout. There was a complaint from the workers that when the room was crowded,
ventilation was not sufficient and they feel very uncomfortable. Hence, the management
has installed another fan and ask the workers to switch it off, when there is less workers
in the waiting room. However, it has been found this is not being practicing well, and
most of the time both fans are working unnecessarily. You have been asked to automate
the switching on and off fans depending upon the number of workers inside the room.
There is an entry door and exit door. Assuming that workers cannot enter through exit
door and exit through the entry door and having two sensors to detect when someone
comes in goes out.
(a) it is required to design an electronic circuit to obtain the following requirements.
Both fans should be in OFF position when nobody inside the room.
Only one fan should be on when there is less than or equal to two workers inside
the room
Assume that only maximum of five workers can be accommodated and entry door
get locked until a worker goes through the exit door.
Consider S1 sensor is ON when someone enters and S2 sensor is on when
someone moves out.
F1 should be ON to run the first fan and F2 should be ON to run the second fan
by the PLC output and fans are off otherwise.
Write a PLC program to work in the required manner considering S1, S2 are inputs and
F1, F2 and L are outputs. L is connected in such a way that when L is in ON position, the
entry door gets locked.
(b) After some times, the management wants to do the following modification to the
system to avoid the frequency of switching on and off of the fans.
There should be a delay of 10 seconds before any of the fan is ON and it should
be ON if the condition for the fan does not get changed during that10 seconds.
Also, before a fan is switched to OFF position, it should be checked whether the
condition remains the same for 8 seconds. If the condition (for the fan to be off)
does not get changed during that time, then it should be OFF.
Palitha Dassanayake 5
Programmable Logic Controllers
You can use the following counters and timers as you wish using S7-200
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
Palitha Dassanayake 6