Sei sulla pagina 1di 9

2.

9 Timer functions
2.9.1 On-delay timer
The most commonly used device in relay or PLC systems, after switches and relays, is the
timer. The most common timing function is TIME DELAY ON. The simplest instruction
producing this function in the SIEMENS S7 PLC is the On-Delay Timer Coil.
I0.0

T2
timer No

K1T

SD
S5T#2s
T2

Q1.0

K1T

2s

time value specified (2 sec)

Electromechanical relay
equivalent circuit
If the signal state of input I0.0changes from 0 to 1 (positive edge) timer T2 is started.
If the specified time elapses and the SS of I0.0 is still 1, output Q4.0 changes from 0
to 1. If I0.0 changes from 1 to 0, the timer is stopped.
EEET 2204 Industrial Automation by Dr Peter Graszkiewicz

Time waveforms help to explain the operation of a timer.


timer starts
1

I0.0

0
time

T2

1
0

t
t = programmed time value (delay)

The output signal changes to 1 only when the programmed time has elapsed
and the input signal is still 1.

EEET 2204 Industrial Automation by Dr Peter Graszkiewicz

Example
Design a PLC-based system in which two lamps, A and B, are
controlled in the following manner. When the switch is turned on,
lamp A is lit immediately and, after 10 s lamp B is lit. Both lamps are
switched off when the switch is open.
I1.0

Q1.0
Lamp A

Q1.0

I1.0 Q1.0

T1
SD

Q1.1

Timer

S5T#10s
T1

PLC

Q1.1
Lamp B

PLC connections
Ladder Logic Program
EEET 2204 Industrial Automation by Dr Peter Graszkiewicz

The On-Delay function can be also provided by the On-Delay Timer instruction

Timer designation
Start input

Start input

I:0

Q1.1

Q1.0

2
T4:0

O:0

DN

15

SIEMENS
Timer Done

R = Reset input
TV = Time Value input/Preset value

AB

Q = Output
BI, BCD = Remaining time value
EEET 2204 Industrial Automation by Dr Peter Graszkiewicz

The Reset (R) input resets the time base to zero, if it changes from 0 to 1.
timer starts

timer starts

Reset

S
R

Q
delay

delay

The reset function is usually used to re-establish the conditions at the start
of a program cycle after the previous cycle has been completed.

EEET 2204 Industrial Automation by Dr Peter Graszkiewicz

2.9.2 Off-Delay Timer


The output signal is 1 when the input signal is 1 or while the timer is running. The
programmed time is started when the input signal changes from 1 to 0.
I0.0

T5
S_OFFDT

T5

S5T#2s
Q4.0

Off-Delay Timer Coil


timer starts

S5T#1h_15m

SIEMENS
timer starts

Off-Delay Timer

timer is reset and starts again

S or I0.0
Q or T5
Delay
EEET 2204 Industrial Automation by Dr Peter Graszkiewicz

Delay
6

Example
Lubrication for main motor bearings is required for 30 s after the
supply of the motor is switched off. The main motor contactor is
controlled by a PLC. Write a program for controlling the motor of the
lubricating pump.
T1

Q0

Off-Delay

Main Motor
Contactor

30 s

Q0
T1

Q1

PLC

Q1

Lubricating Pump
Motor Contactor

PLC connections

Generic
symbol!
(Requires
explanation)

T1 is 1 when Q0 is 1 (main motor ON) and stays 1 for 30 s after


Q0 changes to 0 (main motor is switched OFF). If Q0 changes
01 while the timer is running (multiple switching of the main
motor), the timer is reset and will time to 30 sec. The SS of T1
corresponds to the On/Off state of the lubrication pump motor.

EEET 2204 Industrial Automation by Dr Peter Graszkiewicz

In general, the same timer function can be achieved using different timers.
The resultant program, however, may be more difficult to understand.
The previous problem solved using the On-Delay timer:
Main
Motor ON

T1

Q0

On-Delay

Timer starts

Main motor
(Q0)

30 s
Timer input

Q0

T1

On-Delay

Q1
Timer output
(T1)

Q1
Pump (Q1)
Q1 stays latched
EEET 2204 Industrial Automation by Dr Peter Graszkiewicz

2.9.3 Other Timers - Examples


Extended Pulse Timer (One-shot Timer): The output signal remains at 1 for
the programmed length of time, regardless of how long the input signal stays
at 1. (One pulse is generated.)
input
output
Preset value

Retentive Timer On-Delay: As long as the input is 1 the timer increments its
accumulator until the preset value is reached.
input
t1
t2
t1 + t2 + t3 = preset value

Output
(DN)

t3

AB
EEET 2204 Industrial Automation by Dr Peter Graszkiewicz

2.10 Counters
2.10.1 Up Counter

Acc. value
Preset value
N+1
N

initial acc.
value

AB

time

Relevant numbers appear during


programming and program execution.

DN

1
0

If the input changes 01 (positive edge),the accumulated value is incrementedby


one count. When Accum = Preset, DN changes 01. DN (counting done) can be
used to initiate the next step in the program.
C5:0

The Reset instruction resets the accumulated value to 0. It is


used to prepare the counter for a new count up in the next cycle
of the program.
EEET 2204 Industrial Automation by Dr Peter Graszkiewicz

10

Acc. value

2.10.2 Down Counter


initial acc.value

Preset
value, eg. 2

DN 1

AB

CV

C#<value>

count value

PV

SIEMENS
S: 01 sets the count value (accumulated value)
with the preset value PV
R: 01 sets the count value to 0 (resets the
counter)

S
Q

EEET 2204 Industrial Automation by Dr Peter Graszkiewicz

11

Example
A typical application of counters is monitoring of the number of parts on a
conveyor. The motor of a conveyor is to stop automatically after 20 packages have
been delivered to the temporary storage area. The Storage Full lamp is to be lit at
that instant. The packages travelling on the conveyor break the beam of the
photoelectric barrier so that a pulse is generated for each passing package. Develop
a PLC program for the system.
STORAGE FULL

Photoelectric barrier
ON

OFF

START

Temporary storage

EEET 2204 Industrial Automation by Dr Peter Graszkiewicz

12

System component

Address

Push-button ON (N/O)
Push-button OFF (N/C)
Push-button START (N/O)
Photoelectric barrier
Motor contactor coil
Lamp STORAGE FULL

Network 1: Turn system ON

Network title

Pressing pushbutton ON turns the system ON

I0.0

I0.1

I0.0
I0.1
I0.2
I0.3
Q4.0
Q4.1

M0.0

Network comment
Memory Bit ( a coil without an
associated PLC output terminal)

M0.0

EEET 2204 Industrial Automation by Dr Peter Graszkiewicz

13

Network 2: Start Motor


Pressing pushbutton START switches the supply
to the coil of the conveyor motor contactor.

I0.2

M0.0

Q4.0

This is the SET COIL instruction. If


M0.0 and I0.2 is ON, Q4.0 is set to 1
and stays 1, regardless of the
following states of the rung. This
instruction can be used instead a coil
with a latch (vide Network 1)

Network 3: Counter
Counter C1 count down at each change of the photoelectric barrier signal from 0
to 1. Input I0.3 is 1 when the barrier is broken by a package. Pushbutton START
sets the counter with the value of 20.
C1
I0.3
I0.2
C#20

I0.2
SIEMENS
EEET 2204 Industrial Automation by Dr Peter Graszkiewicz

14

Network 4: Stop Motor


If pushbutton OFF is depressed or counter C1
counts down to 0, the motor is stopped.

C1

RESET COIL instruction. It resets


Q4.0 address to 0, if there is 1 at
the coil input.

Q4.0
R

I0.1

Network 5: Lamp STORAGE FULL

SET COIL and RESET COIL instructions


(SIEMENS) correspond to OUTPUT
LATCH and OUTPUT UNLATCH
instructions (A-B).

Lamp STORAGE FULL is lit when the counter


counts down to 0.

C1

M0.0

Q4.1

EEET 2204 Industrial Automation by Dr Peter Graszkiewicz

15

The same program using generic symbols:


I0

M0 System ON

I1

O1

C1

R
I1

M0

Motor OFF

Generic address syntax


M0

I2

O1 Motor ON

C1

M0

O2

C1
I3
Count down
from 20 to 0

STORAGE FULL
indicator

Done

01
Reset to 20

This is a generic symbol of a counter and


requires explanation, through symbols and/or
text, as to what is the relationship between
the relevant input/output signal states.
EEET 2204 Industrial Automation by Dr Peter Graszkiewicz

16

2.11 Flowcharting
A flowchart is a pictorial representation of program logic. It can help to develop a
ladder logic program, in particular, for large processes.
The following flowchart symbols will be used:

oval: START & END


No

?
Yes

diamond: point of decision


contains a question
rectangle: process block with
specified operation
parallelogram: indicates an input or output
activity that is not initiated within the program
EEET 2204 Industrial Automation by Dr Peter Graszkiewicz

17

A flowchart for the conveyor counter example in section 2.10.2 can look as shown
below:
The motor of a conveyor is to stop automatically after
20 packages have been delivered to the temporary
storage area. The Storage Full lamp is to be lit at that
instant. The packages travelling on the conveyor break
the beam of the photoelectric barrier so that a pulse is
generated for each passing package.

START

Operator turns
system on

Operator starts
conveyor

Have 20 packages
been counted?

Yes

No

For clarity of the flow chart,


some operations can be left out
(here: OFF p/b operation and
switching off the lamp).

Conveyor stops
and lamp is lit

EEET 2204 Industrial Automation by Dr Peter Graszkiewicz

18

Potrebbero piacerti anche