Progammable Logic Controllers and Applications
Progammable Logic Controllers and Applications
Nilesh J. Vasa
References
• 1) Programmable Logic Controllers:
Programming methods and Applications, John
R. Hackworth, Frederick D. Hackworth Jr.,
Pearson Education, New Delhi, 2004
• 2) Exploring Programmable Logic Controllers
with Applications, Pradeep Kumar Srivastava,
BPB Publications, New Delhi, 2004
Internal • A programmable logic
Memory controller (PLC) is a special
Power
CPU form of microprocessor-
Supply
User based controller that uses a
Memory programmable memory to
store instructions and to
implement functions such as
logic, sequencing, timing,
counting and arithmetic in
Analog Digital Analog Digital order to control machines
Input Input Output Output and processes.
Module Module Module Module • Instead of hardwiring each
control circuit for each
Processor, Controller, or CPU control situation we can use
It consists of following blocks the same basic system for
- Arithmetic Logic Unit (ALU)
different situations
- Program memory and Internal memory
- Internal timers and counters • By changing the instructions
- Flags or temporary registers in the program
PLC Hardware
• Typically a PLC system has five basic components
– Processor unit or Central Processing Unit (CPU)
– Power supply (5/24 V DC)
– Programming device
– Memory unit
– Input and output sections
• PLC manufacturers
– Siemens, Mitsubishi, Toshiba, Allen-Bradley,
Sprecher+Schuh, Telemecanique
PLC Programming
• Use of ladder diagrams
• The ladder diagram consists of two vertical
lines representing the power rails
• Circuits are connected as horizontal lines, i.e.
the rungs of the ladder, between the two
verticals
AND PB1 • PB2
OR
PB1 + PB2
2) As soon as CR1 energizes, the N/O 3) When the relay contact closes, we no
CR1 contact in parallel with S1 closes. longer need switch S1 to maintain a path
for current flow through the rung because
it is provided by the N/O CR1 contact and
N/C pushbutton S2. The N/O CR1 contact
“seals” or “latches” the circuit ON.
Important safety feature: when the power fail when the machine is on, the latch rung will de-energize.
However, when the power is restored, the machine will not automatically restart. This must be manually
restarted by pressing S1.
Single cycle circuit
In some applications, the machine must perform only one cycle and then stop, even if
the operator is still depressing the run switches.
Therefore, circuitry is usually needed to assure that once the machine has completed
one cycle of operation, it stops and waits for the RUN switch(es) to be released and
then pressed again.
In order for the circuitry to be able to determine where the machine is in its cycle, a
cam-operated limit switch must be installed on the machine.
CR1: OFF
(as S1: OPEN)
1) CR3: ENERGIZED
(as LS1B: CLOSE)
CR1: ENERGIZE
(as S1: CLOSE)
CR2ENERGIZE
(as CR1: CLOSES, CR3: already CLOSE)
As a result the machine cycle begins
CR3: DE-ENERGIZE
(as LS1B: OPENS)
CR1: DE-ENERGIZE
(as S1: OPEN)
CR3: DE-ENERGIZE
(as LS1B: OPEN)
Eventually, the m/c finishes its cycle and the cam switch rides into the cam detent.
Single cycle circuit: Continued
If the operator does not release the SRART switch before the machine finishes its cycle.
Eventually, the m/c finishes its cycle and the cam switch rides into the cam detent.
CR2: DE-ENERGIZE: stopping the machine. Then, when the operator releases S1, CR1
turns OFF, and CR3 turns ON.
The circuit is now back in its original state and ready for another cycle.
Single cycle circuit: Continued
1) If the machine cycles so quickly that the cam switch “flies” over the detent in the
cam. The machine will cycle endlessly.
2) If the machine has high inertia, it is possible that it may “coast” through the stop
position. In this case, some type of electrically actuated braking system must be
added that will quickly stop the machine. The brakes could be actuated by a N/C
contact on CR2.
• In a chemical plant a tank will be
Examples filled with two chemicals, mixed
and then drained. When the start
button is pressed at input I0, the
program starts pump 1 controlled
by output O0.
• Pump 1 runs for 5 s, filling the
tank with first chemical, then
shuts off.
• The program then starts pump1,
controlled by output O1. Pump
runs for 3 s filling the tank with
the second chemical. Then shuts
off.
• The program starts the mixer
motor, connected to output O2
and mixes the two chemicals for
60 s.
• The program then opens the
drain valve controlled by output
O3 and starts pump 3 controlled
by the output O4.
• Pump 3 shuts off after 8 s and the
process stops.
• A manual stop switch is also
provided at the input I1.
• In the ladder diagram, I0 is a pushbutton
switch to start the process and I1 is a push
button switch to stop the process at any
instant. O0, O1, O2 and O4 are the four
outputs to run the pump1, pump2, drain valve
and pump3, respectively. Four timers T1, T2,
T3 and T4 are suitably chosen to have time
base 100 ms each. The ladder diagram is
written to fulfill the need of chemical process.
I0 I1 CR2 CR1
1 When I0: CLOSE
CR1: ENERGIZE
CR1
TDR3,
CR1 ON 5s
2 TDR: ON-Delay: 5S
CR1 CR3 O0
3 ( ) Pump 1 runs for 5s
TDR4,
CR1 CR3 ON 3s
4 TDR: ON-Delay: 3S
CR1 CR5 O4
8 ( ) Drain valve opens
TDR6,
CR1 CR5 ON 8s
9 TDR: ON-Delay: 8s
IN2
RESET
In some cases ACTUAL value is set to PRESET value (rather than reset it to zero)
Counter
• Two separate rung counters: these have an advantage in that
the reset rung can be located anywhere in the program does
not need to be located immediately following the count rung
1) IN1 (rung 1) causes the
counter C1 to increment (or
decrement, if it is a down
counter) IN1 C1 (CTR)
2) IN2 (rung 2) causes the ( )
counter C1 to reset to zero
(or reset to the preset value IN2 C1 (RESET)
if it is a down counter)
( )
C1 OUT1 (OUT)
( )
IN1 C2 (UPCTR)
( )
IN2 C2(DOWNCTR)
( )
IN3 C2 (RESET)
( )
IN1
N/O contact IN1 advances SEQ1
SEQ1 ( )
IN1
SEQ1
( )
Non-retentive timer
Retentive timer
Timers
• When the control line becomes true (IN1 closes), the timer
ACTUAL value is incremented each 0.1 or 0.01 s. When the
actual value is equal to the PRESET value, the coil associated
with the timer (in this case TIM1) is energized and the ACTUAL
value incrementing ceases.
• The PRESET value must be set so that the timer counter
ACTUAL value will increment from zero to the required using
a0.1 or 0.01 s rate timer.
• For instance, suppose a timer of 5.0 s is required using a 0.1 s
rate timer. The PRESET value would need to be 50.
IN1
TIM1
( )
ACTUAL
PRESET
Example
• Design a ladder network that will provide a delayed-on
sequence TIM1, TIM2, and TIM3. The sequence will be
initiated by IN1. In operation, when IN1 is activated, TIM1 will
switch ON 3 s later. Then 1 s later TIM2 will switch ON,
followed by TIM3 2.5 s afterwards. All signals will be reset
when IN1 is switched OFF.
TIM2
TIM3
( )
Pr = 25 TIM3
The sequence is initiated by energizing IN1, which starts timer TIM1.
Then IN1 is switched OFF, all timers in the sequence reset and the
network is immediately ready to start again.
TIM2
TIM3
( )
Pr = 25 TIM3
Example
• A machine’s electrically operated automatic
oiler is connected to dispense oil when OUT1
of the PLC is ON. It has been determined that,
because it is over-oiling the machine, the
operator wishes to reduce the amount of oil
dispensed by periodically cycling it ON and
OFF. Design a PLC program that will operated
the oiler connected to output OUT1 when
input IN1 is ON. When ION1 is ON, the output
OUT1 is to cycle continuously ON for 0.5 s and
OFF for 1.0 s.
Solution
• We will need two non-retentive timers: 0.5 s and 1.s
• The timers will be connected such that the first enables the second, and the second disables
the first.
• Flasher operation:
– In rung 1 of this network, IN1 activates TIM1.
– In rung 2: after TIM1 times out (0.5 s after IN1 is switched ON), TIM2 is started timing.
– Then 1 s later, when TIM2 times out, the N/C TIM2 contact in rung 1 opens which resets
and restarts TIM1.
– Since TIM1 is restarted, this will consequently reset TIM2 in rung 2.
– Therefore, when IN1 is ON TIM1 will continuously cycle OFF for 0.5 s and ON for 1.0 s.
– Rung 3 of our program is enabled by IN1. As long as IN1 is ON, OUT1 is simply the
inverse of TIM1.
– Hence, OUT1 will be ON for 0.5 s and OFF for 1.0 s.
TIM1 Pr=5
TIM2
Notice that the network has two coils: TIM1 and OUT1, in parallel.
PLC: Location in the control
architecture
Enterprise Network
Engineer Operator Supervisor
gateway
station station Station
Control Bus
(e.g. Ethernet)
PLC
large
COM1
COM 2
COM1 Control Station
COM 2
COM1
CPU
PLC
CPU
CPU
I/O
with Field Bus gateway
PLCs
I/O
I/O
I/O
I/O
I/O
I/O
I/O
I/O
I/O
direct I/O
Field Bus Field Bus
COM
COM
COM
COM
CPU
CPU
CPU
COM
I/O
I/O
I/O
I/O
I/O
I/O
I/O
directly connected
I/O
Field Stations FB
gateway Field Devices
small PLC
data concentrators,
not programmable,
but configurable
Sensor Bus (e.g. ASI)