0% found this document useful (0 votes)
21 views

05 PLCs

Plc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views

05 PLCs

Plc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 26

Programmable Logic Controllers

Introduction
Programmable logic controllers (PLC) are logic industrial controllers that were developed primarily to control
sequencing systems. Each step in an event sequencing system occurs only when certain conditions are met
and certain steps have occurred. This is equivalent to each output signal being active only when certain input
sensor states exist and/or certain event steps are in progress or have occurred.

A PLC receives signals from sensors, performs logic operations that define the outputs and then writes the
output signals to the actuators. Figure 5.1 illustrates connection of sensors and actuators to the PLC.
Inputs

Outputs
Sensing devices
PLC Actuating devices

Figure 5.1 A block diagram of a PLC-controlled system

Operation of a PLC (using Ladder Logic)


A PLC runs a program to sequence operations. The operation of a PLC program can be explained using ladder
logic. Ladder logic is a way of writing PLC programs that mimics relay switching circuits. A ladder diagram has
two vertical lines called bus lines. In between the bus lines are program lines in the form of ladder rungs.
Figure 5.2 shows an example of a ladder program. The term ladder is used because the lines of a completed
diagram resemble the rungs of a ladder.

Figure 5.2 A typical ladder diagram

36
The bus lines mimic the power supply rails (24V and 0V) and each ladder rung mimics a relay switching
circuit. Each rung in a ladder program has input contacts and at least one output. Input contacts are
generally of the normally open (NO) and the normally closed (NC) types. The NO is normally open and closes
when the contact is activated. The NC is normally closed and opens when activated. Symbols used for the
normally open contact, the normally closed contact and the output are shown in figure 5.3.

NO contact NC contact Output

Figure 5.3

An output on a ladder rung (mimicking a coil on a relay circuit circuit) is energized only when there exists a
path from the positive supply rail (bus line) through the input contacts and the coil to the negative supply rail
(bus line).

The inputs in a rung are connected together in such a way to give a logic condition that in turn turns on or
off the output(s) connected in the rung. The logic conditions may be series, parallel or series-parallel
connections of the contacts. Figure 5.4 shows examples of ladder rungs.

(a)

(c)

(b)

Figure 5.4 Ladder rungs

1. In (a) the output Y goes high (active) when input signals to X1 and X2 go high and input signal to X3
goes low. In Boolean logic, 𝑌5 = 𝑋1 ∙ 𝑋2 ∙ 𝑋3
2. In (b) the output Y goes high when any of the inputs X1, X2 and X3 go high. In Boolean logic, 𝑌 =
𝑋1 + 𝑋2 + 𝑋3
3. In (c) the output Y goes high when {C and Z are low, X is high} and either A and B are high or D is
high. In Boolean logic, 𝑌1 = ((𝐴 ∙ 𝐵) + 𝐴) ∙ 𝐶 ∙ 𝑋 ∙ 𝑍

The PLC rungs, thus basically perform Boolean logic operations.

37
The input contacts can be input points on PLC or internal bits in the PLC memory. Likewise, output coils can
be output points on the PLC or internal memory bits. Sensors connected to input points close or open the
contacts when they sense the objects they are designed to sense. Likewise, output points turn on actuators
when they are energized.

Simple PLC application example


Consider a hydraulic system that has an indicator lamp to indicate that the system is healthy. A hydraulic
system is said to be healthy when:
1. The pump is running (sensed by an auxiliary contact on a pump starter).
2. There is oil in the tank (sensed by a level switch which closes when the switch is covered).
3. There is oil pressure (sensed by a pressure switch which closes for adequate pressure).

The relay circuit that may be used is shown in figure 5.5 (a). In a PLC application of the system, the sensors
are all connected to input points on the PLC and the lamp to an output point as shown in figure 5.5 (b). The
circuit between the sensors and the actuator is implemented by a software program running on the PLC. The
program can be represented in the form of a ladder rung as shown in figure 5.5 (c).

(a)

(b)

(c)

Figure 5.5

The PLC Scan


A typical PLC program contains a number of rungs, for example the ladder program in figure 5.6. The steps
that are followed when the PLC is running are:
1. The PLC reads all the inputs and stores their states in as an input image stored in memory.
2. The PLC evaluates each rung on the ladder and writes the resulting output states to an output image
stored in memory.
3. The PLC writes the output image to the output devices.

38
Figure 5.7

The above set of steps is known as a PLC scan. The PLC will continuously go through scans. For each scan, the
outputs are updated as necessary. In the process, a control function can be achieved. Figure 5.7 illustrates a
PLC scan.

Scan rate
Scan rate is the speed at which a PLC scans the memory. It is expressed in terms of the number of seconds
(or milliseconds) it takes to scan a given amount of memory, usually 1kB. The actual time to scan a program
depends on the scan rate, the length of the program and the types of functions used in the program. The
faster the scan rate the more often the inputs and outputs are checked.

Phasing errors
The CPU under the control of the operating system, scans the input image rather than the inputs
themselves. The input memory is not changed while the CPU is scanning it. Thus it is possible for an input

39
port to change its state from, say, off to on and back to off before the input image is updated. A phasing
error is said to have occurred when the CPU scan misses a change in the state of an input port.

(a) (b)

Figure 5.7. (a) PLC program scan cycle (c) PLC memory organization

Architecture of a PLC
A PLC is a microprocessor-based or microcontroller-based device. Figure 5.8 shows the general architecture
of a PLC.

Figure 5.8

The CPU
The CPU is in form of a microcontroller or a microprocessor. Its role is to control all operations in the PLC by
executing a program (or set of programs) stored in the memory.

40
PLC software
PLC programs consist of an operating system (OS) and a user program. The OS is a program that manages all
functions and all other programs in the PLC. The user program is a program that performs the logic
operations to switch outputs based on states of inputs.

Memory
Memory is used to store programs and data. It can be a mixture of ROM, RAM, EPROM, EEPROM flash RAM
and battery backed RAM. Memory is divided into the following groups that are used as follows:
1. Executive memory which is used to store the OS. Since the OS rarely needs changes after
development, this memory section is usually implemented as ROM.
2. System memory which is used to store system data. Mainly, system data is used by the OS. System
memory is implemented in RAM.
3. I/O status memory which is used to store input and output images. An image can be defined as a
copy of the states of the inputs or outputs on the PLC. I/O status memory is implemented in RAM.
4. Data memory which is used to store data associated with the user program. Functionalities like
timers, counters, numerical calculations, data storage and auxiliary relays require memory. This
memory is implemented in RAM.
5. User program which is used to store the user program. It can be implemented in EPROM, EEPROM,
flash RAM or battery backed RAM. The memory is required to be involatile because the program is
required as is until there is probably need to change the process being controlled. However, the
flexibility of changing the program is still required.

The address, data and control buses


The CPU, memory and I/O unit are linked by an address bus, a data bus and a control bus. The three buses
form the main system bus.

The address bus enables addressing of the memory and the I/O unit by the CPU. The data bus allows
exchange of data between the CPU and memory and I/O unit. The control bus is used to carry the necessary
control signals.

The I/O unit, the system I/0 bus and I/O devices
The I/O unit is used to interface the system I/O bus to the main system bus. The system I/O bus in turn
provides a link for communication between the I/O unit and the input devices and output devices.

Input devices are used to interface to input sensors. Output devices are used to interface to actuators. Once
connected, the sensors and actuators are mapped to some addresses by the I/O unit.

The input and output devices provide signal conditioning and isolation functions between the delicate
internal circuitry and the harsh industrial environment. They are also known as interface modules.

Interface Modules
Interface modules are constructed as standard devices that allow the PLC to be directly connected to a wide
range of sensors and actuators. Different types of interface modules are available. Each module type is
suited for a particular function.

Digital input modules


Digital input modules are used to interface to discrete sensors. The following are typical digital module types
(in terms of nature of PLC input signal):

41
1. 0/24V DC
2. 0/110V DC
3. 0/220V AC
4. 0/5V TTL

A digital input module has a number of input points - typically 8, 16 or 32 input points.

Input isolation
The main function of the digital input modules is to provide input isolation. Optical isolation is exploited.
Figure 5.9 illustrates optical isolation on a PLC input point.

(a)

(b)

(c)

Figure 5.9 Optical isolation of inputs: (a) opto isolator (b) DC input (c) AC input

The plant sensor (plain switch, sourcing or sinking type) applies a current signal to the input point. The
photodiode part of the opto isolator transfers this signal as light to the phototransistor part. The transistor in
turn switches internal PLC circuitry and hence transfers in the signal without a physical electrical connection.

42
The reasons for use of optical isolator are:
 The PLC operates at TTL levels while the plant operates at higher voltages. Input isolation is used to
protect the delicate internal PLC circuitry from the harsh plant voltages.
 Separating the plant supplies from plant supplies ensures that the PLC is not adversely affected by noise
signals in the plant. Electrical noise may result from voltage spikes on signal lines, or from load currents
flowing in AC neutral or DC return lines. The differences in earth potential between the PLC cubicle and
outside plant can also cause problems.

Digital output modules


Digital output modules are used to interface to discrete actuators. The following are typical types of digital
modules (in terms of nature of PLC input signal):
1. 0/24V, 100mA DC
2. 0/110V, 1A DC
3. 0/220V, 1A AC (triac)
4. 0/220V, 1A AC (relay)

A digital output module has a number of input points - typically 8, 16 or 32 input points.

Inputs are also isolated using opto isolators. Figure 5.10 shows output isolation.

(a)

(b)

Figure 5.10 DC output circuits: (a) DC output circuit, current sourcing; (b) effect of current suppression diode

The opto isolator transfers signals from the PLC internal circuitry to the switch on the output point with no
physical electrical contact. Diode D1 is used to clip spikes due to noise. Noise interference can be more of a
problem on outputs because of the higher currents that are being controlled by the cards and the loads
themselves that are often inductive (e.g. solenoid and relay coils).

43
Figures 5.11 and 5.12 show the two basic types of output card, one with common supply and the other with
separate supply for each output.

(a)

(b)

Figure 5.11 Types of output cards: (a) output card with common supply; (b) output card with separate
supplies

44
Figure 5.12 AC output circuit: (a) AC output stage; (b) effect of triac output

Analog input modules


Analog input modules receive analog signals from sensors and convert them into digital signals. After
conversion to digital, the input signal is represented, at least, as an integer number for use by the PLC
program. Each module has a number of input points – typically 4, 8 or 16 inputs.

Resolution
Resolution is the smallest change in the analog input that causes a change in the digital output. It is the
amount of analog input corresponding to unity or binary one.

As an example, an 8-bit ADC can represent an integer in the range 0 – 255. If this was used to represent an
analogue signal measuring a flow with a span (range) from 0 to 1800 l/min, the resolution would be
approximately 7 l/min (given by 1800/255).

Resolution may be viewed in terms of an error.

A 12-bit ADC gives a better resolution (0.5 l/min)

Conversion to engineering units


The digital output value from the ADC needs to be converted to engineering units. The conversion is
performed as follows. If N is the raw digital value, HR the high-range measurand, LR is the low range
measurand and n is the number of bits in the output, the measured value MV is given by:
𝑁(𝐻𝑅−𝐿𝑅)
𝑀𝑉 = + 𝐿𝑅
2𝑛 −1

45
Analog output modules
Analog output modules perform analog to digital conversion of outputs so that they can be sent as analog
signals to actuators needing such signals. Each module has a number of output points – typically 4, 8 or 16
outputs.

The conversion from engineering units to the DAC input is as follows:


(𝑁−𝐿𝑅)(𝐻𝑅−𝐿𝑅)
𝑉𝐴𝐷𝐶 = × 𝑉𝑠
2𝑛 −1

where VADC is the value passed to the DAC, N is the output number in engineering units, HR/LR are
the high- and low-range values, n is the number of bits in the input value and Vs is the supply voltage
to the DAC (maximum possible output).

Other Types of Modules


There are other modules that may be included for specific special functions. Generally, one or two may be
required in an application. Some typical special function modules are:
1. Communication modules used to interface the PLC to other controllers or computers.
2. RTD modules to provide interface to RTDs and provide functions specific to RTDS.
3. Thermocouple modules to provide interface to thermocouples and provide functions specific to
thermocouples.
4. Encoders cards to interface to encoders.
5. PID modules to provide PID control functionalities.

PLC construction

Single unit
Small PLCs are implemented in the form of a single unit. All the PLC components and modules are built into
one unit. Connection points are provided for connecting to the sensors and actuators. Limited expansion can
be achieved by adding a few more I/O modules. Figure 5.13 shows a typical single unit PLC.

Figure 5.13

Modular PLCs
Medium and large PLCs are implemented in modular form. A number of units each for a specific function are
built separately and then connected together to give the PLC. The units are mounted on a rack. Figures
5.14(a) and (b) show typical modular PLC constructions.

46
Figure 5.14 (a)

Typical units found in a modular PLC are:


1. Power supply module which is responsible for producing various power supply levels to the various
modules in the PLC.
2. CPU module which houses the CPU and memory parts of the PLC.
3. I/O modules, each module built into a unit called an I/O card. Each I/O card is built to connect to a
number of inputs or outputs of the same type typically 8 digital inputs, 8 digital outputs, 4 analog
inputs, 4 analog outputs, etc. per unit.
4. System bus which is a card at the backside of the PLC which provides connections between the
different cards that make up the PLC.

There can also be other types of cards mounted onto the rack.

Figure 5.14 (b) shows construction format with labels of modules.

Figure 5.14 (b)

47
Remote I/O
This is when I/O cards are mounted on racks that are a distance from the main PLC but local to the sensors
and actuators. The remote I/0 cards are connected to the main PLC using a communication channel, for
example an optic fibre or LAN cable. Sensors and actuators are wired to the remote cards using the usual
conducting wires.

The remote I/O card thus receives signals from sensors and multiplex them for transmission to the main PLC
via the communication channel. The cards also receive signals via the communication channel from the main
PLC, de-multiplex them and send them to the actuators.

Benefits of remote I/O are:


 Reduced cabling. Expensive multicore cables are only for short distances between sensors/actuators
and the I/O cards. Cheaper and fewer communication cables run between the I/O cards and the
main PLC.
 It makes commissioning and fault finding easier.

Generally, a terminal is provided local to ach remote rack so that plant operation can be monitored local to
the plant devices.

Effect of scan time in remote I/O


The effect of scan times can become even more complex when remote serially scanned I/O racks are
present. These are generally read by an I/O scanner as shown in Figure 5.15, but the I/O scanner is not
usually synchronised to the program scan. In this case with, say, a program scan of 30ms and a remote I/O
scan of 50ms, the fastest response could be 30ms, but the slowest response (with an input just missing the
I/O scan and the I/O scan just missing the program scan) could be 130ms.

PLC manufacturers offer many facilities to reduce the effect of scan times. Typical are high-speed
independent I/O cards and the ability to sectionalise the program into areas with different scan rates.

Figure 5.15 The effect of program scan and I/O scan cycles

48
PLC Programming
Addressing
PLCs identify I/O devices and memory using some form of addressing. Different PLCs generally use different
ways of addressing. Allen Bradley addressing and Siemens addressing will be briefly explored.

Allen Bradley addressing


Allen Bradley addressing uses address of format: IDENTIFIER:RACK SLOT/BIT.
IDENTIFIER is a letter to identify the type of module being accessed (input, output), RACK is the
number of the rack containing the module, SLOT is the number of the slot that contains the card and
BIT is the input or output point on the card. Input cards use the identifier I while outputs use the
identifier Q. Racks are numbered from 1; slots are numbered from 0; bits are numbered from 0.
Examples are:
 O:26/05 means bit 5 on output card in rack 2, slot 6
 I:35/02 means bit 2 on input card in rack 3, slot 5

Memory bits
In Allen Bradley PLCS, memory can be addressed as bits or words of certain bit width. Bits are addressed
using a similar approach as for I/O points. The identifier for memory bits is B. The format for a memory bit
address is BM/n where n denotes the bit and M denotes the file containing the bit. For example, B3/25
means bit 25 on file 3.

0 1 2 3 4 5 6 7

PLC
processor

0 1 2 3 4 5 6 7

0 1 2 3 4 5 6 7
O:26/05

I:35/02

Figure 5.16 Identification of plant signals

49
Siemens addressing
Digital I/O in Siemens PLCs is arranged in groups of 8 bits, called a byte. An I/O signal is identified by its bit
number (0 – 7) and its byte number (0 – 127). Inputs are denoted in the form I<byte>.<bit> and outputs in
the form Q<byte>.<bit>. For example:
 I9.4 means input with bit address 4 in byte 9
 Q63.6 means output with bit address 6 in byte 63.

Like Allen Bradley, Siemens use card slots in one or more racks. The cards are available in 16-bit (2-byte) or
32-bit (4-byte) form.

Figure 5.16 shows the Siemens card layout and addressing. Figure 5.17 (a) shows fixed slot addressing. In
most systems, however, the user has the ability to assign the byte addresses. This is known as variable slot
addressing and is shown in figure 5.17 (b). The first byte address and the range (2-byte or 4-byte) can be set
independently for each slot by switches in the adaptor module in each rack.

Figure 5.17 Siemens card layout: (a) Fixed slot addressing; (b) Variable slot addressing

Memory addressing
 Memory can be addressed as bits, bytes, words or double words.
 Words are 16 bits wide while double bytes are 32 bits wide.
 Memory bits use the identifier MB for example MB5.6 is bit 5 in memory at address 5.
 Memory bytes use the identifier M for example M13 is byte at memory address 13.

50
 Memory words use the identifier MW for example MW8 is word at memory address 6. The word
occupies two consecutive addresses, in this case addresses 6 and 7. Addresses of memory words are
therefore multiples of 2.
 Memory double words use the identifier MD for example MD12 is word at memory address 12. The
word occupies four consecutive addresses, in this case addresses 12, 13, 14 and15. Addresses of
memory double words are therefore multiples of 4.
 I/O can be accessed as bytes, words or double words in a similar manner to accessing bytes, words
and double words in memory. For example, Q7 is a byte output to output byte 7.

PLC programming
There are three main methods that can be used for PLC programming. These are ladder logic, statement list
and logic symbols.

After the program has been written, it is converted into machine language that can run on a PLC. Programs
are loaded into the PLC’s memory using a program loader. These vary from hand held systems incorporating
a small keyboard and LCD to conventional computers.

Ladder programming
As mentioned in an earlier section, ladder programming uses ladder logic to write PLC programs. A program
is entered in a form that mimics relay switching circuits.

Latching
A latch is used to maintain an output state even if the input contact which energised it is turned off. Figure
5.18 shows latching in a ladder rung.

Figure 5.18 (a)

51
Figure 5.18 (b)
Figure 5.18 (a) A latching rung (b) motor starter PLC wiring and PLC ladder diagram

When the Start contact makes, Step-1 is energised thereby making the Step-1 input contact. If Start later
opens, the output Step-1 is kept energised. The closed input Step-1 thus, keeps the output Step-1 energised
even if the input Start opens. In other words, the output latches itself.

Figure 5.18 (b) shows the application of latching in the start/stop control of an electric motor.

Auxiliary relays
These are memory bits that can be used to store single bit information about a process. They may represent
a step or a state in an event sequencing system, for example ‘standby pump running’, ‘system healthy’ and
‘lubrication fault’.

Sequencing of steps
To achieve sequencing states of rung outputs are made to depend on states of other rungs in such a way as
to generate the required sequence. Consider the ladder program for a two-step process shown in figure
5.19. Only one of the two steps is required at any given time. Step-1 and Step-2 are auxiliary relays that are
used to represent (and show the states) of the two steps. Start and stop are NO push to make switches
connected to a PLC input. When Start is momentarily pressed while the process state is 1, process goes into
step 2. If Stop is momentarily pressed while in step 2, the process goes into step 1.

52
Figure 5.18

Suppose the process starts in step 1:


 In step 1, Step-1 NO and Step-2 NC contacts are closed while Step-1 NC and Step-2 NO are open.
 The path that feeds the relay bit Step-1 is closed by the Step-1, Step-2 line. This keeps this relay
energised until there is a change in states of either Step-1 NO contacts or Step-2 NC contacts.
 No complete path exists to Step-2 relay bit, unless and until Start NO contacts close.
 If Start is pressed, the Step1, Start line on the input to Step-2 relay bit closes thus energising Step-2
bit. Step-2 NO contacts close and Step-2 NC contacts open.
 The resulting opening of the Step-2 NC contacts break the Step-1, Step-2 line on the input to the
Step-1 relay bit and hence Step-1 bit is de-energised. Step-1 NO contacts open and Step-1 NC
contacts close. Step 2 of the process is entered.
 The Step-2, Step-1 line on the input to the Step-2 relay bit keeps the Step-2 relay it energised
(latches it) thus process stays in step 2 unless and until Stop is pressed.
 If Stop is pressed, the Step2, Stop line on the input to Step-1 relay bit closes thus energising Step-1
bit. Step-1 NO contacts close and Step-1 NC contacts open.
 The resulting opening of the Step-1 NC contacts break the Step-2, Step-1 line on the input to the
Step-2 relay bit and hence Step-2 bit is de-energised. Step-2 NO contacts open and Step-2 NC
contacts close. Step 1 of the process is entered.
 The Step-1, Step-2 line on the input to the Step-1 relay bit keeps the Step-1 relay it energised
(latches it) thus process stays in step 1 unless and until Start is pressed.

It can be observed that each subsequent step kills the previous step. Whenever step 2 is switched on, step 2
is automatically switched out. Secondly entering a subsequent step only occurs when the process is in the
preceding step and conditions of entering the new step are satisfied. Step 2 is entered only when the
process is in step 1 and start is pressed. Step 1 is only entered when the process is in step 2 and stop is
pressed.

53
In general, each step on a ladder designed for sequencing consists of:
1. A path with conditions to go into a step.
2. A path to latch the current step as well as to kill the previous step.

First Cycle bit


It is a bit that goes high only in the first scan cycle of a PLC following power up. It can be used to dictate the
first step that a process assumes following power on. In figure 5.18, the process will go into step 1 when the
PLC powers up. Step-1 NC contacts will ensure step 2 is not entered and then Step-1 NO contacts and Step-2
NC contacts will latch the system in step 1 when the first cycle bit clears.

Logic symbols (notation) or Function block diagrams


It has already been observed that PLC program lines are basically Boolean logic in nature. Hence, logic
symbols may also be used to write PLC programs. Figure 5.19 typical logic symbols that are used in
programming of PLCs as well as an example program line.

Figure 5.19 PLC programming using logic symbols (Siemens notation): (a) an AND gate; (b) truth table for
AND gate: (c) hydraulic healthy lamp of figure 5.11 in logic notation; (d) an inverted input

A test to check if a signal is not true is denoted by a small circle ‘◦’ (this is equivalent to testing a normally
closed contact in ladder diagram notation). Hence the output Z of the AND gate in figure 5.19 (d) is true if
(and only if) A and C are true and B is not true.

Statement lists
A ladder diagram can be translated into a program consisting of instruction lines. Table 5.1 shows typical
instructions for a PLC.

54
Table 5.1 Typical instruction list
Instruction Description
LOAD Load contact

AND Logical AND operation

OR Logical OR operation

NOT Inversion

LOAD NOT Load inverse

AND NOT Logical AND NOT operation

OR NOT Logical OR NOT operation

AND BLOCK Logical AND two sub-circuits

OR BLOCK Logical OR two sub-circuits

CONSTANT Insert constant for timer or


counter

RESET Reset counter

OUT Output

END End ladder

Different manufacturers may use different instructions but the logic is similar.

Figure 5.20 shows a simple operation in both ladder and logic formats for a Siemens PLC. The equivalent
statement list is given in Table 5.2.

Figure 5.20 Equivalent ladder and logic statements in Siemens notation

Table 5.2 Statement list


Instruction Operation Address Comment
number
00 :A I3.7 Forward pushbutton

01 :A I3.2 Front limit OK

02 :AN Q4.2 Reverse solenoid

03 := Q4.11 Forward solenoid

55
Figure 5.21 and Table 5.3 show a more complex program in the three notations

Figure 5.21 More complex program in both notations

Table 5.2 Statement list


Instruction Operation Address Comment
number
00 :A( First set of brackets

01 :O F3.3 Manual forward

02 :O F3.4 Automatic forward

03 :) Result of first set of brackets

04 :A( AND result with second set of brackets

05 :O I2.0 Motor 1 selected

06 :O I2.1 Motor 2 selected

07 :) Now at point X

08 :A I4.1 Front limit switch healthy

09 :AN Q5.5 Reverse starter

10 := Q5.6 Forward starter

56
Timers
Timers count pulses generated from the CPU’s internal clock. They count these pulses until they get to the
preset value, a point when some delay period would have been realised. Counters enable delay operations
to be implemented in control. The preset value of the timer is the delay period.

Typical types of counters are:


1. Delay-on and delay-off timers. These turn on or off after a specified delay.
2. Pulse timers. These give a positive going or negative going pulse of a specified duration.
3. Repeating timers. These repeatedly turn on and off at a regular specified interval. They are also known
as cyclic timers.

The timer operations are shown in figure 5.22.

Figure 5.22 Different forms of timer: (a) on delay; (b) off delay; (c) fixed width pulse

Timer signals
The following are signals available on a timer:
 Enable, EN – is a mimic of the timer input
 Timer timing, TT – is energised whilst the timer is running (i.e. preset value hasn’t expired)
 Time done, DN – indicates timer has finished (preset value has expired)

Figure 5.23 shows the signals as used on an Allen Bradley delay on timer (TON) and a delay off timer (TOF).

57
Using timers in programs
PLC manufacturers differ on how a timer is programmed. Most use the timer as a terminator for a rung, with
the timer signals being available as contacts for use elsewhere. Others use the timer as a delay block with
the preset being stored in a value block.

Most timers used are non-retentive (accumulated time goes back to zero when the input goes to zero); but
retentive timers (these require reset signal) are also available.

Figure 5.23 Allen Bradley timer notations: (a) TON timer; (b) TOF timer

Figure 5.24 illustrates two ways of programming a timer.

Figure 5.24 Two types of time in the same application: (a) Allen Bradley notation; (b) Siemens logic notation

58
Counters
Counters are used to count externally generated pulses. A counter is, like a timer, associated with a preset
value. If the count value reaches the preset value, a count complete or count done signal is given. The count
value itself is also available for use in the program. A counter can be reset.

There are two types of counters: up-counters and the down-counters. Up-counters count up to the preset
value while a down-counters count down from the preset value to zero.

Most PLCs allow a counter to count up to 32767. Where larger counts are needed, counters can be cascaded
with the complete (or done) signal from the first counter being used to step the second counter and reset
the first. In a similar way, timers can also be cascaded with counters to get longer timer periods. Figure 5.25
is a variation of the same idea used to give a very long timer.

Figure 5.25 Cascaded counters

Numerical applications
Numeric representations
So far we have been primarily discussing single-bit operations. Numbers are also often part of a control
scheme; a PLC might need to calculate a production rate in units per hour averaged over a day, or give the
amount of liquid in a storage tank. Such operations require the ability to handle numeric data.

59
Functions are available to handle numeric data in the form of integers (16-bit words), long integer (two 16-
bit words) or floating point numbers that consist of two 16-bit words, which contain the mantissa (the
numerical portion) and the exponent.

Data movement
Numbers are often required to be moved from one location to another; a timer preset may be required to
be changed according to plant conditions, a counter value may need to be sent to an output card for
indication on a digital display or the result of some calculation may be used in another part of a program.

Functions (or instructions) are available for such data movements (Figure 5.26).

Figure 5.26 Data movement: (a) Allen Bradley; (b) Siemens

Data comparison
Numerical values often need to be compared in PLC programs: typical examples are a batch counter saying
the required number of items have been delivered, or alarm circuits indicating, say, a temperature has gone
above some safety level.

These comparisons are performed by elements which have the generalised form of Figure C.24, with two
numerical inputs corresponding to the values to be compared, and a binary (on/off) output which is true if
the specified condition is met.

Value 1
Compare Result
Value 2

Figure 5.27 Basics of data comparison

60
Arithmetic operations
PLCs provide the ability to do mathematical operations such as add, subtract, multiply and divide (Figure
5.28).

Figure 5.28 Arithmetic operations in Allen Bradley PLC

GRAFCET
GRAFCET is a tool for describing a sequencing system. It, thus can be used in development of PLC programs
for these sequencing systems.

A GRAFCET consists of:


· Steps to which are associated certain actions.
· Transitions which are conditions to be fulfilled before moving from step to the next.
· Directed links which link the steps and the transitions.

In the PLC application, a step represents a process state, actions represent the outputs to be turned on in a
particular step and a transition points represent the closing (or opening of) an input contact.

A separate handout gives details of GRAFCET.

PLC Design Process


1. Design and built the circuit for the sensors and actuators.
2. Allocate inputs and outputs on the PLC.
3. Develop the PLC program.
4. Download the program to the PLC and test run.
5. Loop back through steps as necessary to ensure specifications are met.

61

You might also like