Programmable Logic Controllers
PLC Timer Functions
In
many control tasks there is a need to control time. For example, a motor or a
pump might need to be controlled to operate for a particular interval of time,
or perhaps be switched on after some time interval. PLCs thus have timers as
built-in devices. Timers count fractions of seconds or seconds using the
internal CPU clock. This chapter shows how such timers can be programmed to
carry out control tasks.
When the
instructions before the timer symbol are
true the timer starts
"ticking". When the time elapses the timer will
automatically close its contacts. When the program is running on the plc the program typically displays the elapsed or
"accumulated" time for us so we can see the current value.
Types
of Timers
PLC manufacturers differ on how timers should
be programmed and hence how they can be considered. A common approach is to
consider timers to behave like relays with coils which when energized result in
the closure or opening of contacts after some preset time. The timer is thus
treated as an output for a rung with control being exercised over pairs of
contacts elsewhere. This is the predominant approach used here. Some treat a
timer as a delay block which when inserted in a rung delays signals in that
rung reaching the output
Treatment
of timers
There are a number of different
forms of timers that can be found with PLCs. With small PLCs there is likely to
be just one form, the on-delay timers. These are timers which come on after a
particular time delay Figure (a). Off-delay timers are on for a fixed period of
time before turning off Figure (b). Another type of timer that occurs is the
pulse timer. This timer switches on or off for a fixed period of time Figure (c).
TON is used to denote on-delay, TOF off-delay, and TP pulse timers. On-delay is
also represented by T–0 and off-delay by 0–T.
Timers:
(a) on-delay (b) off-delay (c) pulse
BOOL indicates a Boolean
input/output, i.e., on/off. IN is the input. Q is the output. ET is the elapsed
time output. PT is the input used to specify the time.
Figure shows the IEC 1131-3 standard
symbols for timers.
The time duration for which a timer
has been set is termed the preset and is set in multiples of the time base
used. Some time bases are typically 10 ms, 100 ms, 1 s, 10 s and 100 s. Thus a
preset value of 5 with a time base of 100 ms is a time of 500 ms. For
convenience, where timers are involved in this text, a time base of 1 s has
been used.
Programming
Timers
All PLCs generally have delay-on
timers, with small PLCs possibly having only this type of timer. Figure 12.4a
shows a ladder rung diagram involving a delay-on timer. Figure (a) is typical
of Mitsubishi. The timer is like a relay with a coil that is energized when the
input In 1 occurs (rung 1). It then closes, after some preset time delay, its
contacts on rung 2. Thus the output occurs some preset time after the input In
1 occurs. Figure (b) shows the timer to be a delay item in a rung, rather than
as a relay, the example being for Siemens. When the signal at the timer’s start
input changes from 0 to 1, the timer starts and runs for the programmed
duration, giving its output then to the output coil. The time value (TV) output
can be used to ascertain the amount of time remaining at any instant. A signal
input of 1 at the reset input resets the timer whether it is running or not.
Techniques for the entry of preset time values vary. Often it requires the
entry of a constant K command followed by the time interval in multiples of the
time base used. Figure shows ladder diagrams from Telemecanique, Toshiba and
Allen-Bradley.
Sequencing As an illustration of the
use of a timer, consider the ladder diagram shown in Figure (a). When the input
In 1 is on, the output Out 1 is switched on. The contacts associated with this
output then start the timer. The contacts of the timer will close after the
preset time delay, in this case 5.5 s. When this happens, output Out 2 is
switched on.
S is Boolean start input. TV is
duration of time specification. R is Boolean reset. BI is current time value in
binary word. BCD is current time value in BCD word Q is Boolean output,
indicating state of timer.
(a)
Mitsubishi
(b)
Siemens
(c)
Telemecanique
(d)
Toshiba
(e) Allen-Bradley
The enable bit EN is set to 1 when
there is a logic path to the time. The done bit DN indicates the status of the
timer and is set to 1 when the accumulated value equals the preset value.
Sequenced
outputs
Thus, following the input In 1, Out
1 is switched on and followed 5.5 s later by Out 2. This illustrates how timed
sequence of outputs can be achieved. Figure shows the same operation where the
format used by the PLC manufacturer is for the timer to institute a signal
delay.
Figure shows two versions of how
timers can be used to start three outputs, e.g., three motors, in sequence
following a single start button being pressed. In (a) the timers are programmed
as coils, whereas in (b) they are programmed as delays. When the start push
button is pressed there is an output from internal relay IR1. This latches the
start input. It also starts both the timers, T1 and T2, and motor 1. When the
preset time for timer 1 has elapsed, then its contacts close and motor 2
starts. When the preset time for timer 2 has elapsed, then its contacts close
and motor 3 starts. The three motors are all stopped by pressing the stop push
button. Since this is seen as a complete program, the end instruction has been
used.
Motor
sequence
Cascaded
Timers
Timers can be linked together (the
term cascaded is used) to give longer delay times than are possible with just
one timer. Figure 12.7a shows the ladder diagram for such an arrangement. Thus
we might have timer 1 with a delay time of 999 s. This timer is started when
there is an input to In 1. When the 999 s time is up, the contacts for timer 1
close. This then starts timer 2. This has a delay of 100 s. When this time is
up, the timer 2 contacts close and there is an output from Out 1. Thus, the
output occurs 1099 s after the input to In 1. Figure 12.7b shows the Mitsubishi
version of this ladder diagram and the program instructions for that ladder.
Cascaded
timers
On-Off
Cycle Timer
Figure(a) shows how on-delay timers
can be used to produce an on-off cycle timer. The timer is designed to switch
on an output for 5 s, then off for 5 s, then on for 5 s, then off for 5 s, and
so on. When there is an input to In 1 and its contacts close, timer 1 starts.
Timer 1 is set for a delay of 5 s. After 5 s, it switches on timer 2 and the
output Out 1. Timer 2 has a delay of 5 s. After 5 s, the contacts for timer 2,
which are normally closed, open. This results in timer 1, in the first rung,
being switched off. This then causes its contacts in the second rung to open
and switch off timer 2. This results in the timer 2 contacts resuming their
normally closed state and so the input to In 1 causes the cycle to start all
over again. Figure (b) shows how the above ladder program would appear in the
format used with a timer considered as a delay, rather than as a coil. This
might, for example, be with Siemens or Toshiba. When input In 1 closes, the
timer T1 starts. After its preset time,
On-Off
Cycle Timer (a)
On-Off
Cycle Timer (b)
there is an output to Out 1 and
timer T2 starts. After its preset time there is an output to the internal relay
IR1. This opens its contacts and stops the output from Out 1. This then
switches off timer T2. The entire cycle can then repeat itself.
Off-Delay
Timers
Figure shows how an on-delay timer can be used
to produce an off-delay timer. With such an arrangement, when there is a
momentary input to In l, both the output Out 1 and the timer are switched on.
Because the input is latched by the Out 1 contacts, the output remains on.
After the preset timer time delay, the timer contacts, which are normally
closed, open and switch off the output. Thus the output starts as on and
remains on until the time delay has elapsed.
Off-delay
timer (a)
Some PLCs have, as well as on-delay
timers, built-in off-delay timers and thus there is no need to use an on-delay
timer to produce an off-delay timer. Figure 12.11 illustrates this for a
Siemens PLC, giving the ladder diagram and the instruction list. Note that with
this manufacturer, the timer is considered to be a delay item in a rung, rather
than a relay. In the rectangle symbol used for the timer, the 0 precedes the T
and indicates that it is an on-delay timer.
Off-delay
timer(b)
As an illustration of the use of an
off-delay timer, consider the Allen-Bradley program shown in Figure 12.12. TOF
is used to indicate that it is an off-delay, rather than on-delay (TON) timer.
The time base is set to 1:0 which is 1 s. The preset is 10 so the timer is
preset to 10 s. In the first rung, the output of the timer is taken from the EN
(for enable) contacts. This means that there is no time delay between an input
to I:012/01 and the EN output. As a result the EN contacts in rung 2 close
immediately there is an I:012/01 input.
Application
of an off-delay timer
Thus there is an output from
O:013/01 immediately the input I:012/01 occurs. The TT (for timer timing)
contacts in rung 3 are energized just while the timer is running. Because the
timer is an off-delay timer, the timer is turned on for 10 s before turning
off. Thus the TT contacts will close when the set time of 10 s is running.
Hence output O:012/02 is switched on for this time of 10 s. The DN (for done)
contacts, which are normally closed, open after the 10 s and so output O:013/03
comes on after 10 s. The DN contacts which are normally open, close after 10 s
and so output O:013/04 goes off after 10 s.
Pulse
Timers
Pulse timers are used to produce a
fixed duration output from some initiating input. Figure 12.13a shows a ladder
diagram for a system that will give an output from Out 1 for a predetermined
fixed length of time when there is an input to In 1, the timer being one
involving a coil. There are two outputs for the input In 1. When there is an
input to In 1, there is an output from Out 1 and the timer starts. When the
predetermined time has elapsed, the timer contacts open. This switches off the
output. Thus, the output remains on for just the time specified by the timer.
Pulse-on
timer
Figure (b) shows an equivalent ladder
diagram to Figure (a) but employing a timer that produces a delay in the time
taken for a signal to reach the output. In Figure (a)(b)(c), the pulse timer
has an output switched on by an input for a predetermined time, and then
switching off. Next figure shows another pulse timer that switches an output on
for a predetermined time after the input ceases. This uses a timer and two
internal relays. When there is an input to In 1, the internal relay IR 1 is
energized. The timer does not start at this point because the normally closed
In 1 contacts are open. The closing of the IR 1 contacts means that the
internal relay IR 2 is energized. There is, however, no output from Out 1 at
this stage because, for the bottom rung, we have In 1 contacts open. When the
input to In 1 ceases, both the internal relays remain energized and the timer
is started. After the set time, the timer contacts, which are normally closed,
open and switch off IR 2. This in turn switches off IR 1. It also, in the
bottom rung, switches off the output Out 1. Thus the output is off for the
duration of the input, then being switched on for a predetermined length of
time.
Pulse
timer on, when output ceases
Programming
Examples
Consider a program (Figure) that
could be used to flash a light on and off as long as there is some output
occurring. Thus we might have both timer 0 and timer 1 set to 1 s. When the
output occurs, then timer 0 starts and switches on after 1 s. This closes the
timer 0 contacts and starts timer 1. This switches on after 1 s and, in doing
so, switches off timer 0. In so doing, it switches off itself. The lamp is only
on when timer 0 is on and so we have a program to flash the lamp on and off as
long as there is an output.
Flashing
light
As an illustration of programming
involving timers consider the sequencing of traffic lights to give the sequence
red only, red plus amber, green, amber, and then repeat itself. A simple system
might just have the sequence triggered by time, with each of the possible
states occurring in sequence for a fixed amount of time. Figure shows the
sequential function chart and a possible ladder program to give the sequence.
Examples
1)
Traffic light
sequence
2)
Allen broadly PLC timer
Develop a program that
when a button is pushed it latches a bit that will activate the MOV command.
The MOV command then places a value into a timer which will control an output
for a specific amount of time. When the timer is done, the bit is then
unlatched.
This example shows that
when a button is pushed, the binary bit B3:3/1 is latched. This bit then
activates the MOV command to move the value of five into the preset of the
timer T4:0. This timer keeps the output O:2/2 on for five seconds. When the
timer is done, the bit B3:3/1 is then unlatched.
PLC
Ladder Practice Problem:
Automatically infusing the
container with liquids A and B in order when START is pressed.When it reaches
the set level, mix the two liquids evenly then open the valve to let out the
mixture.
Topics Covered in this example is PLC based Batch Process.
Number
of PLC Inputs Required
X1 – Start Switch.
X1 – Low level float sensor. X1 = ON when the
liquid level reaches X1.
X2 – High level float sensor. X2 = ON when the
liquid level reaches X2.
X3 – Stop Switch.
X10 - EMERGENCY STOP button. X10 = ON when the button is pressed.
Number of PLC Outputs Required
Y0 – Liquid A Inlet
Y1 – Liquid B Inlet
Y2 – Mixture Outlet
Y3 – Agitator /Stirrer
Number of PLC Timer Required
T0 – 60 second Timer, 100 ms Time Base. (See K60 Preset Value for
Timer)
T1 – 120 second Timer, 100 ms Time Base. (See K1200 Preset Val.
for Timer)
PLC
Ladder Programming:
PLC
Ladder Program Description:
· X0 = ON when
START is pressed. Y0 will be ON and latched, and the valve will be opened for
infusing liquid A until the level reaches the low-level float sensor.
· X1 = ON when the
level reaches the low-level float sensor. Y1 will be ON and latched, and the
valve will be opened for infusing liquid B until the level reaches the
high-level float sensor.
· X2 = ON when the
level reaches the high-level float sensor. Y3 will be ON and activates the agitator.
Also, timer T0 will start to count for 60 sec. After 60 sec, T0 will be ON, and
the agitator motor Y3 will stop working. Y2 will be ON and latched, and the
mixture will drain out of the container.
· When Y2 = ON,
timer T1 will start to count for 120 sec. After 120 sec, T1 will be ON and Y2
will be OFF. The draining process will be stopped.
· When an error
occurs, press EMERGENCY STOP button X10. The NC contact X10 will be ON to
disable all the outputs. The system will then stop running.
0 comments:
Post a Comment