Chapter 2
Chapter 2
Chapter 2
Controller (PLC)
• Lack of flexibility as well as the large time needed for any change in wiring
of the hardwired circuit.
• A major issue of troubleshooting with soiled and worn-out contacts, loose
wires, and difficulty with connection diagrams.
To overcome the limitations of such hardwire-based relay logic (Figure 2.1), a group
of engineers at GM proposed a new design of ‘Standard Machine Controller’ which
was the primitive form of PLC. Based on this idea, four major companies (Allen-
Bradley, Digital Equipment Corporation, Century Detroit, and Bedford Associates)
attempted to build a prototype.
Bedford Associates first successfully designed PLC for commercial use of General
Motors in 1969. In 1974, Allen-Bradley introduced a new design to satisfy the cus-
tomers’ needs and named their device as ‘Programmable Logic Controller’ (PLC)
over the then-accepted term ‘Programmable Controller’. During this introductory
phase of PLC, Richard Morley, known as the father of PLC, contributed a lot toward
its development. He originally designed the ladder logic for PLC programming. Odo
Josef Struger of Allen-Bradley also contributed a lot for the development of PLC.
Some of the milestones toward the development of PLC are shown in Figure 2.2.
15
16 Industrial Automation Technologies
in computer to work with. Versatility, flexibility, cost efficacy, and ruggedness pro-
vide the PLC a special edge in process automation. The schematic diagram of a PLC
is shown in Figure 2.3.
2.1.6 Features of a PLC
A PLC has a number of features that would satisfy various requirements in process
automation:
TABLE 2.1
Industrial Applications of PLC
Programmable Logic Controllers 19
TABLE 2.2a
Input Devices Connected to the PLC
TABLE 2.2b
Output Devices Connected to the PLC
dedicated keys. But, at present, desktop or laptop PCs are more popular for PLC pro-
gramming. There are five different PLC programming languages: LD, functional block
diagram, Sequential Function Chart (SFC), Structured Text (ST), and Instruction List (IL).
There are two ways of entering programs in a PLC:
To stay competitive in the market, PLC vendors are providing integrated and com-
plete solutions across end user industries that are looking for solutions which will
reduce the engineering and other related expenses. PLC market consists of three
types of vendors:
the PLC is stored in system read-only memory (ROM) which manages the
operation of the PLC. The arithmetic logic unit (ALU) section of the CPU
along with internal storage registers performs all the required arithmetic
and logical operations as per the program written in user RAM. Control
unit of CPU controls the timing of all the operations. After the execution of
the program in CPU, all the outputs are fed to the output module to change
the status of the output channels.
• Power supply and battery backup: PSU provides the necessary power
to the CPU as well as input and output modules. Most of the PLCs oper-
ate with ± 5 V DC and hence the power supply module converts the power
line voltage (120 V AC/240 V AC) to the required DC signal with various
circuitries as shown in Figure 2.7.
However, to prevent loss of programs from volatile RAMs when the
power supply goes off due to supply breakdowns, usually a power backup
in the form of uninterruptable power supply (UPS) is used in the PLC to
provide power. Usually rechargeable lithium-ion battery is used in such
cases, which can provide the required backup for several years. Recently
large capacitors are also used to provide power backup but such backups are
limited to seventy-two hours.
• Program and data memory: Program memory stores the program used
by the microprocessor for generating the control actions depending on the
input. It is the library where the application program is stored. Process data
from the input modules and control data from the output modules are tem-
porarily stored in data memory as data tables. An image of these data tables
are used by the CPU. There are several memory elements in a PLC system
as shown in Figure 2.8.
• Read only memory (ROM) provides permanent storage for the operat-
ing system and fixed data used by the CPU.
• Random access memory (RAM) is provided for the user’s program and
data. Programs and data in RAM can be changed by the user. A portion
of the RAM is used to store the status of the input and output devices,
the values of the timers and counters, and other internal devices.
• There is a provision to incorporate an electrically erasable and pro-
grammable read-only memory (EEPROM) for user programming.
• Input and output modules: Input module is used to provide the interface
between the PLC and the input devices (sensors, switches, etc.). Every input
point has a unique address and the status or information available at the
inputs can be read by the CPU of the PLC. To protect the CPU, every input
is electronically isolated (by opto-isolator) and all the inputs on a single
module have similar circuitry for handling identical nature of inputs.
Output module is used to interface between the PLC and the output
devices (relay, triac, etc.). After the inputs are received by the CPU, it exe-
cutes the program and provides the status to the output points. Isolation is
provided between the CPU and the output devices. Choice of the output
module depends on the specifications (i.e., current and voltage rating) of
the output actuator. Similar to the input module, a single output module has
similar output circuitry for handling similar type of actuators.
• Buses: In PLC architecture, a number of buses exist, which carry data and
control signals. The buses are the paths used for communication within
the PLC. The CPU buses are: data bus, address bus, and control bus. The
system bus is used for communication between the PLC and the external
I/O devices through I/O ports.
Other than these three modes, there is another mode called remote mode. This mode
provides remote access of the PLC from a master PC. Remote mode is effective
when the PLC is in a location not easily accessible. The operating mode can be
changed using a programming device or by sending a command using Host Link
communications.
• Scan time: How fast a PLC can perform a task is defined by the term ‘scan
time’. It is defined as the time required by a PLC (basically CPU) to acquire
the input status, to execute the application program, to provide updated
signals to the output devices, and lastly for self-diagnostics and commu-
nication. For PLCs used in process control applications, scan time usually
varies from 50 milliseconds to 0.1 second per 1K (1024) words. Thus, it is a
cyclic process consisting of four steps as shown in Figure 2.10.
During input scan, data in the input status table is read by the user
program when program is executed and the output status table is updated
accordingly. Data associated with output status table is transferred to output
terminals and in the last phase of the cycle, CPU performs self-diagnostics
as well as communication with host computer or any other devices con-
nected to the PLC.
The input status is updated during input scan and likewise, output
status is updated during output scan. After input scan, input image is
fed to the program execution section. During program execution, pro-
gram scanning takes place from left to right (rung scanning, usually fol-
lowed in Allen-Bradley PLC) or from top to bottom (column scanning,
followed by Modicon/Schneider PLC) across each rung. Figure 2.11a
(a) (b)
FIGURE 2.11 (a) PLC rung scanning. (b) PLC column scanning.
30 Industrial Automation Technologies
and Figure 2.11b show the manner in which PLC rung scanning and
column scanning are done.
• Interrupt-driven and clock-driven execution modes: A program run-
ning cyclically can be interrupted if put in an interrupt-driven mode of
program execution when fast reaction time is required. For an interrupt-
ing signal occurring at fixed intervals, a time synchronous execution is
implemented, i.e., with closed-loop control function. The cyclic execu-
tion, synchronized by a real-time clock, is the most common program
structure for a PLC.
During the selection of I/O modules for a PLC, the concept of sourcing and sinking
should be very clear to a user. The concept of sourcing and sinking is related to
only DC circuits where the direction of current flow is defined. Figure 2.12(a)
and Figure 2.12(b), respectively, show the sourcing DC output module. Similarly,
Figure 2.12(c) and Figure 2.12(d), respectively, show the sinking DC input module. In
Figure 2.12(a) ‘Load 1’ is not connected to the PLC, whereas in Figure 2.12(b) ‘Load 1’
is connected, and hence current flows through it from PLC output module to the ground.
Similarly, in Figure 2.12(c), field contact is open and once it is closed (Figure 2.12(d))
current flows from external source through the field contact to the PLC input module.
If the PLC input or output module provides current for any input or output device, then
PLC is considered to be as sourcing device. Alternatively, if external supply is required
to provide current for PLC input or output modules then the PLC is considered to be a
sinking device. The most common form of the PLCs has sourcing output module and
sinking input module.
Programmable Logic Controllers 31
(a) (b)
(c) (d)
FIGURE 2.12 (a) Sourcing DC output module with ‘Load 1’ is not connected to the PLC,
(b) Sourcing DC output module with ‘Load 1’ is connected to the PLC. (c) Sinking DC input
module with field contact is open, and (d) Sinking DC input module with field contact is closed.
• Ladder Diagram: LD is also known as ladder logic which mimics the relay
logic used for batch processes. Due to its simple understanding (i.e., mini-
mum training is required) this programming language has become most
popular for the plant technicians.
• Mnemonic Instructions: MI is a set of machine-level instructions
(commands for microprocessor) are used for programming. These instruc-
tion sets can be directly derived from the ladder logic diagram.
• Sequential Function Charts: SFC is a flowchart-like programming tech-
nique with multiple paths but is more powerful than MI.
• Structured Text: ST programming language is nearly similar to high-level
PC programming language like PASCAL. It is very flexible and intuitive to
develop complex programs.
32 Industrial Automation Technologies
One of the primary benefits of the standard IEC 61131-3 is that it allows multiple
languages to be used within the same programmable controller. This allows the pro-
gram developer to select the language most well-suited for each particular task.
(a) (b)
FIGURE 2.13 (a) Conventional electric circuit for motor On-Off control. (b) Ladder
Diagram for motor On-Off control.
Programmable Logic Controllers 33
FIGURE 2.14 Physical wiring and ladder diagram for motor connection.
the motor gets the power. Figure 2.13b is the equivalent Ladder Diagram representa-
tion of Figure 2.13a.
In Figure 2.13b, vertical lines L1 and L2 are known as power rail. Here, L1 is con-
sidered to be a source and L2 is considered to be a sink. The horizontal line is known
as rung, which represents the control portion (switch is connected) of the circuit.
Hence, in LD representation emphasis is provided only on the control technique
rather than on the physical wiring.
Figure 2.14 is a more realistic presentation of PLC LD for a motor On-Off
operation. By energizing the input contact (IN001, normally open, i.e., NO con-
tact), relay (CR001, normally open) gets energized and closes the motor circuit
to turn it On.
Figure 2.15a is an extension of the previous motor On-Off operation with a start-
stop-hold arrangement. To start the motor, ‘Start’ button is pressed to energize the
motor starter coil and it also energizes the ‘Hold’ contact to keep the motor On even
after releasing the ‘Start’ button. To make the motor stop, we have to press the ‘Stop’
button to disconnect the supply of control power to the motor starter coil, which also
results in the release of the ‘Hold’ contact. If there is a failure of control power (mal-
functioning of source power of L1) then also the motor goes Off. Even after resuming
the control power, motor will not start unless the ‘Start’ button is pressed, and this
provides a safety feature to the motor operation.
In case of PLC LD of Figure 2.15b, by energizing the NO contact IN001, control
relay CR001 gets energized, which further energizes the NO contact CR001 to make
the motor On. Now, to stop the motor, NC contact IN002 needs to be energized to
disconnect the source power from control relay CR001 which further de-energizes
(a) (b)
FIGURE 2.15 (a) Conventional electric circuit for motor On-Off-Hold control. (b) Ladder
Diagram for motor On-Off-Hold control.
34 Industrial Automation Technologies
(a) (b)
FIGURE 2.16 (a) Conventional electric circuit for motor On-Off-Hold with forward and
reverse control. (b) Ladder Diagram for motor On-Off-Hold with forward and reverse
control.
CR001 contact. Here, in case of conventional electrical relay circuit (Figure 2.15a)
‘Hold’ contact is physically connected to the starter relay coil of the motor, i.e., it gets
energized or de-energized with the relay coil. But, in case of PLC LD, ‘Hold’ contact
(NO contact CR001) is internally realized by the PLC logic and it gets energized or
de-energized along with the relay coil CR001.
In Figure 2.16a, we have the facility to rotate the motor in forward (FR) and
reverse (RV) direction as per our requirement along with On-Off-Hold facility.
Before changing the direction of rotation we have to press the ‘Stop’ button. To start
the motor in forward direction, ‘FR’ button is pressed which energizes the ‘FR’ relay
coil and the hold contact ‘FR1’. It also de-energizes the hold contact ‘FR2’ to pre-
vent any chance of motor rotation in reverse direction. Similarly, starting of motor
in reverse direction can also be realized. Here, interlocking arrangement is provided
in between ‘FR2’ and ‘RV2’ so that both the output relays ‘FR’ and ‘RV’ can’t be
energized simultaneously.
Figure 2.16b depicts the similar PLC LD as with Figure 2.16a, but in a simpler
way. To start the motor in forward direction, NO contact IN002 needs to be ener-
gized, which results energizing of relay coil CR001. Consequently, energizing of
NO hold contact CR001 will make it close and NC hold contact will be open to
ensure forward motion of the motor and to prevent any chance of reverse motion (NC
contacts CR001 and CR002 are interlocked). To stop the motor, NC contact IN001
needs to be energized to cut the power supply to the relay coil. Similarly, to start the
motor in reverse direction, NO contact IN003 needs to be energized, i.e., to close,
which results in energizing relay coil CR002. Similar to the previous case, it causes
energizing of NO hold contact CR002 to make it close and NC hold contact CR002
will be open.
Here, in the preliminary discussion we have discussed with a single phase motor
but in actual industrial applications single phase motors are rarely used for direction
reversal. Moreover, before starting the motor in the reverse direction certain amount
of time delay is required to be provided to make the rotation stop for the connected
load, otherwise, it may cause mechanical stress which leads to the chances of actua-
tor failure.
Programmable Logic Controllers 35
2.3.5 Register
PLC registers are the memory locations that provide temporary storage of data.
Inside the PLC CPU there are two types of registers – internal registers and exter-
nal registers. Users usually do not have access to the internal registers, which
are 4, 8, 16, or 32 bits depending on the choice of the processor. Commonly
found internal registers are – accumulator register, data register, condition code
register, scratch pad register, instruction register, etc. All these registers help to
carry out the arithmetic and logical operations as per the programmed instruc-
tions. Registers are also used to store the time count value for Timer and Counter
functional blocks of a PLC.
External registers are the part of CPU’s RAM, usually of 16 bits and used to
hold variable information. Their size varies depending on the PLC structure and
programming capabilities. Commonly found external registers are – holding regis-
ters, input registers (single or group), and output registers (single or group). Holding
register holds the content of calculation related to arithmetic and logical operations.
As an example for an arithmetic operation, two holding registers contain the two
operands and another holding register contains the destination location of the result.
Input registers are readily accessible to the input modules to store the input status.
Usually, input group register can store 16 bits status of the input terminals. Similarly,
output registers are used to store the status of the output modules (usually 16 bits for
output group register) and the number of output registers is equal to the number of
input registers for a PLC.
2.3.6 Timer
Timer is an important function block for PLC. In various industrial applications
we need to run a process for a certain time interval such as oven temperature,
which must attain the desired value before we place the material into it, and this
is a typical application of On Delay Timer. On the contrary, Off Delay Timer can
keep the cooling fan ON for a predefined time interval after the oven has been
turned off. Before making the output ON or OFF, Timer counts the predefined
time interval in seconds or fraction of seconds using the internal CPU clock of
the PLC.
Depending on the manufacturer, Timers have different forms. Usually we con-
sider Timer output as a relay coil which when energized results in the closure or
opening of the contacts after some predefined time interval. Timers can be usually
classified as – On Delay Timer (non-retentive and retentive), Off Delay Timer, and
Pulse Timer.
(a) (b)
FIGURE 2.19 (a) Ladder Diagram and (b) timing diagram with On Delay Timer of an
industrial PLC. (Courtesy: Automation Manual, Rockwell Automation)
38 Industrial Automation Technologies
FIGURE 2.20 Schematic diagram of Off Delay Timer. (Courtesy: Automation Manual,
Rockwell Automation).
BOOL: Boolean I/O, i.e., On/Off
IN: Input
Q: Output
PT: Preset Time Input
ET: Elapsed Time Output
Once the input (I:009) is disabled, T-OFF starts timing. After elapsing of the PT
delay (PRESET 6 s), DN becomes 0, which in turn makes the contact T7:0 closed
(which is NC) and it results in energizing output O:011.
(a) (b)
FIGURE 2.21 (a) Ladder Diagram and (b) timing diagram with Off Delay Timer of an
industrial PLC. (Courtesy: Automation Manual, Rockwell Automation).
Programmable Logic Controllers 39
(a) (b)
FIGURE 2.22 (a) Ladder Diagram and (b) timing diagram for Pulse Timer operation using
On Delay Timer.
2.3.7 Counter
Counter function is used in PLC for counting the number of events in terms of
transitions (pulses) from low to high or from high to low. In case of Up Counter,
every transition increases the count value whereas in case of Down Counter, it
decreases the count value, and once the specified count value is reached (preset
value for Up Counter and zero for Down Counter), output of the counter switches
to high/low. Typical industrial application of Counter involves counting of objects
in production line.
2.3.7.1 Up Counter
Up Counter (CTU) counts upward each time input to the counter switches from low
to high. As the count value reaches preset value, output of the Counter switches
to high and it remains high until it gets reset. Operation of Up Counter with LD is
shown in Figure 2.23.
(a) (b)
FIGURE 2.23 (a) Ladder Diagram and (b) timing diagram for Up Counter.
40 Industrial Automation Technologies
2.3.8 Arithmetic Function
Depending on the manufacturer, most of the PLCs contain a number of arithmetic
operations – ADD (addition), SUB (subtraction), MUL (multiplication), DIV (division),
SQR (square), SQRT (square root), NEG (negative), ABS (absolute), etc. Usually, the
arithmetic functions operate only when the block is enabled (i.e., low to high). If the
Enable input remains high, then nothing will happen. Repetitive clock is required for
continuous arithmetic operation, e.g., repetitive adding and similarly for others.
(a) (b)
FIGURE 2.24 Symbolic representation of (a) Down Counter and (b) Up-Down Counter.
CD: Down Counter Input, LD: Load Value
PV: Preset Value, CV: Count Value, Q: Output
CU: Up Counter Input
QU: Up Counter Output, QD: Down Counter Output
Programmable Logic Controllers 41
register. If the addition process (Figure 2.25) results in a value which causes
either negative value or overflow of the destination register then output coil
(ADD:005) gets energized.
Modulo (MOD) is a special class of division process where the content of source A is
divided by the content of source B and the remainder is stored in the destination register.
TABLE 2.3
PLC Arithmetic Functions
Function Description
SIN Sine value of the angle in degree
COS Cosine value of the angle in degree
TAN Tangent value of the angle in degree
ASIN Arc Sine value of the angle in degree
ACOS Arc Cosine value of the angle in degree
ATAN Arc Tangent value of the angle in degree
DEG Convert angle value from Radian to degree
RAD Convert angle value from degree to radian
LN Compute Natural Logarithm of the given value
LOG Compute Logarithm to base 10 of the given value
XPY Compute X to the power of Y
CPT Compute a user defined formula
AVE Compute average value of a series on numbers
STD Compute standard deviation of a series on numbers
NEG Perform negation of the given number
ABS Provide absolute value of the given number
TABLE 2.4
PLC Comparison Functions
Function Description
EQU Test whether two numbers are equal
NEQ Test whether one number is not equal to a second number
LES Test whether one number is less than a second number
LEQ Test whether one number is less than or equal to a second number
GRT Test whether one number is greater than a second number
GEQ Test whether one number is greater than or equal to a second number
MEQ Test whether a portion two numbers are equal through masking
LIM Test a number whether it lies between an upper and lower limit
44 Industrial Automation Technologies
By energizing the Enable input (I:013) and while Reset input (I:012) is turned off,
as the Step input (I:011) is enabled, data moves from the specified Register (indicated
by the pointer) with consecutive 5 locations (where the last Register is OR0031) to
the destination Registers (HR0163). On completion of the data movement, function
coil (TR0023) goes ON. A Timer contact may be used as the step contact for the
function.
Conversely, in case of REGISTER TO TABLE move function, data moves
sequentially from a single Register to a specified number of consecutive Registers,
known as Table, and is shown in Figure 2.34.
By enabling the input (I:017) and while Reset input (I:016) is turned off, as the
Step input (I:015) is enabled, data moves from the source Register (HR0173) to 7
consecutive Register locations (indicated by the pointer) where the last Register is
OR0061. On completion of data movement function coil (RT0025) goes ON. As an
example, the changing value of a process parameter stored in Source Register is
sequentially transferred to a number of Destination Registers termed as Table.
2.4.2 Matrix Functions
In PLC programming when a large number of bit status need to be scanned and
thereafter some logic operation is required to be performed, Matrix function of
PLC is preferred over conventional LD. LD technique requires a lot of memory
space and the execution speed is low because of the need to handle a large num-
ber of I/Os. PLC Matrix operation deals with one or two matrices and it results
in another matrix.
As an example, if 100 relay coils need to be energized depending on the input
status of 200 switches (NO/NC) where the logic is so defined that each relay coil will
be energized if both the input contacts (connected to it) are closed. If conventional
ladder logic is used, a LD with 100 lines need to be drawn as shown in Figure 2.35a,
while the convenient Matrix function is shown in Figure 2.35b.
A single line LD defining the Matrix function is all that is needed to use matrix
operation in PLCs. The Matrix function will contain two matrices (Matrix 1 and
Matrix 2) each having 100 logical elements (i.e., 1/0), and an AND operation is per-
formed between the corresponding elements of the two matrices. Resulting output
status will be stored into another matrix and its content is used to energize the output
relay coils. In actual practice, input data or status (i.e., the content of Matrix 1 and
Matrix 2) is stored in two separate series of Registers. And the output is stored in
(a) (b)
(a) (b)
FIGURE 2.36 (a) NAND and (b) NOR realization by combining Matrix functions.
another series of Registers, called Output Registers. Logical OR and XOR opera-
tions can also be performed on the matrix elements.
PLC Matrix function can be utilized to perform COMPLEMENT as well as
COMPARE operations. In case of COMPLEMENT, logical status of the register
content (i.e., each matrix element) is replaced by their respective complement values.
In case of COMPARE function, logical status of the two corresponding bit positions
of two matrices are compared and if they are identical, then output is 1, otherwise
it will be 0.
By combining the PLC Matrix functions AND and COMPLEMENT, NAND
operation can be realized. Here, first AND operation is performed for two matri-
ces and the resultant matrix is subsequently COMPLEMENTed to realize NAND
operation. NOR operation can be realized by combining OR and COMPLEMENT
functions as shown in Figure 2.36.
Here, it is assumed that the analog signal varies linearly throughout the entire
range. Similarly, for driving an analog actuator, PLC can provide analog output
from the analog output module. This module converts the digital output produced
by the PLC into analog signal. Depending on the nature of the input and output
signals (i.e., voltage or current), various analog I/O modules are available with the
PLC with different current and voltage ratings. An isolation circuit protects the
analog I/O modules of the PLC. How a PLC handles the analog signal is shown
in Figure 2.37.
In Figure 2.37, analog signal (output from the sensor) is fed to the PLC for divi-
sion operation by 2 and the resultant output analog voltage is fed to an actuator after
required signal conditioning. Thus, analog signal can be fed to the PLC for required
arithmetic or logical operation before being fed to the actuator.
Selection of an analog input module for a PLC depends on several factors,
among them being voltage level and current magnitude of the input signal, speed
of conversion required, etc. Similarly, the choice of the analog output module for
a PLC is dependent on several factors like required voltage level for the actua-
tor, value of the load resistance, current driving requirement, and the speed of
conversion.
If two analog signals from two different sensors are to be added, proper signal
conditioning of both signals is done to match them with the analog input modules
of the PLC. After addition, the result is fed to the display device through an analog
output module as shown in Figure 2.38a and Figure 2.38b.
(a)
(b)
control variable, i.e., the control action, is also stored in Registers. The number
of Registers involved with PID function depends on the model and manufac-
turer. Control block setup contains the setting for the individual parameter of
the PID controller – proportional gain, reset time, rate time, set point max-min,
output max-min, dead band, scaling parameters, etc. Most of the parameters
of PID block are provided in percentage scale. On enabling the PID function,
Enable coil becomes ON and after computation of PID algorithm, ‘Done’ coil
becomes ON.
The role of cycle time is very crucial in PID function. Usually it is chosen as an
integral multiple of the Scan Time of the PLC. The cycle time of the PID algorithm
represents the time between two calculations of the output value (control value). The
choice of the value of cycle time is dependent on the dynamic behavior of the pro-
cess to be controlled. For a process with a fast dynamic response, cycle time should
be small enough to achieve the desired closed-loop controlling performance. On
the contrary, for processes with slow dynamic response, there is no such stringent
restriction on the choice of the cycle time for a PID controller. The user must have
sufficient knowledge to choose proper choice of the cycle time for an effective PID
control. In addition, a number of alarm functions are also available within the PID
block, which the plant personnel use as per their needs.
FIGURE 2.42 Bit set (BS) function used to set 3rd bit of 16-bit Register HR0004.
FIGURE 2.43 Bit clear (BC) function used to clear 5th bit of 16-bit Register HR0004.
FIGURE 2.44 Bit follow (BF) function used to set/clear 6th bit of 16-bit register HR0004.
52 Industrial Automation Technologies
FIGURE 2.46 Shift right (SR) function for two Registers with 24 bits.
FIGURE 2.47 Multiple shift right (SR) operation for 3 bits at a time.
54 Industrial Automation Technologies
(a) (b)
FIGURE 2.48 Rotate right (RR) operation for 8 bits at a time with entire Register: (a) before
rotation and (b) after rotation.
This technique is very popular in designing moving displays where the same bit pat-
tern is repeated sequentially through the Registers.
Instead of using the entire bits of the Register, a part of the bit pattern can be
rotated, as shown in Figure 2.49. The unused bits of the Register are kept intact.
Similar operations can be done for RL with entire and partial use of Register.
(a) (b)
FIGURE 2.49 Rotate right (RR) operation for 8 bits at a time with partial use of Register
(a) before rotation (b) after rotation.
Programmable Logic Controllers 55
SQO function data (on/off bit patterns) is stored in a file and the address of this
file location is stored in ‘File’ field. This bit pattern can be masked (if required)
by the hexadecimal code written in the ‘Mask’ field. ‘Destination’ file contains
the address of the output module where the SQO is to be moved. ‘Control’ reg-
ister is used for controlling and monitoring of the SQO function. The length of
the sequencer file is written in the ‘Length’ Register and ‘Position’ indicates
the current location of the word in the Sequencer File. This ‘Position’ value is
incremented internally after transferring the Register bit pattern from ‘File’. The
Enable (EN) coil is energized when the sequencer is On. The Done (DN) coil will
get energized when the sequencer has completed stepping through the number of
steps specified for the SQO function. Contacts with these coil addresses may be
used to turn On or Off PLC functions and/or PLC output devices. Reset (RES)
function associated with the ‘Control’ Register can be used to reset the SQO
function.
Here, manual push-button switch IN0017 is repeatedly pressed for generat-
ing logical high signal so that the SQO moves through the steps. But, instead
of using such push- button switch, the Timer block can be used to produce logi-
cal high input for SQO at a predefined regular interval. In order to have vari-
able time intervals between sequencer steps, a second sequencer is utilized. The
new sequencer file contains different integer values which will be loaded in the
accumulator of the Timer block to generate different time intervals instead of a
fixed value. Here, both sequencers must be synchronized to step through the pat-
terns simultaneously. Now, if more than 16 discrete outputs are to be controlled
simultaneously, two sequencers in parallel can be connected such that they step
through 32 defined patterns written in the file. This parallel operation of multiple
numbers of sequencers may be increased to control a large number of discrete
outputs. The SQL function is shown in Figure 2.51.
SQL (sometimes called SQI function also) is used to collect data from input mod-
ules. Figure 2.51 displays a ladder logic diagram that illustrates how to read the
input IN0019 and record the data in data file whose index address is provided in File
Register. Here, Timer block may be used in addition to read the input at a regular
interval.
56 Industrial Automation Technologies
The SQC function, shown in Figure 2.52, is used to read an input IN0021, and
then it will compare the input data to the data stored in the Sequencer Data File. If
the collected data from the input module matches the data in data file (whose index
address is provided in the File Register), the bit found (FD) coil will get energized.
This logical change in FD may be used for any further action.
Steps in an SFC diagram can be active or inactive. Actions are only executed for
active steps. A step can be active for one of the two reasons:
FIGURE 2.53 PLC communication with HMI and I/O extension modules.
the field instruments and the I/O module is connected to the PLC through exten-
sion cables. In case of peer-to-peer link, master-slave (poll-response) communication
technique is used to retrieve information from field instruments. Dedicated com-
munication link is available in case of peer-to-peer connection but it involves large
cabling cost. Star, ring, and bus topologies are also utilized by the PLC for commu-
nicating with field instruments. Standard protocols are always used for communica-
tion between the connected devices.
Communication between PLC and field instruments and others may be synchro-
nous or asynchronous. Synchronous communication is faster than asynchronous one
and is undertaken when huge data is to be transmitted on a regular basis at a very fast
rate. But in practice, in industrial communication, very fast data transfer rate is not
required and also data is intermittent in nature. Thus mostly, data is transferred via
asynchronous communication. Thus, in this case, synchronism between DTE and
DCE is not required and nodes can initiate communication as and when required.
Some popular asynchronous serial standards used in industries are RS-232, RS-422,
RS-485, Ethernet, MODBUS, DF-1, I2C, SPI, etc.
for acquiring data from remote plant locations. Information such as cycle times,
counts, duration, or events, etc. can then be sent back to the PLC for maintenance
and management reporting.
In a remote I/O configuration, the master controller polls the slave I/O for its cur-
rent I/O status. The remote I/O system responds, and the master PLC then signals the
remote I/O to change the state of outputs as dictated by the control program in the
master PLC. This entire cycle occurs hundreds of times per second.
terminal; e.g., sending all the necessary parameters to other PLCs and coordinating
the sequencing of various events.
usually have a time limit to prevent a single node from tying up the token for a
long period. Other media access control mechanisms are also utilized by various
protocols designed as per OSI-ISO model. For encoding data before transmis-
sion, baseband modulation techniques are usually popular compared to broad-
band modulation techniques.
must also find out the required special functions other than conventional
binary logic.
• Electrical requirements: Current and voltage ratings of the I/O devices
need to be defined and connected along with the system power require-
ments. The number of I/O modules required and their nature, i.e., current
sourcing/sinking type must be known.
• Speed of operation: The speed of operation, i.e., scan time plays a piv-
otal part in choosing the right type of PLC for a particular application. It
depends on the dynamic behavior of the process or application and in such
cases one needs to consider the time requirement for the fastest possible
operation (i.e., input device sensing to output device actuation). CPU speed
as well as the size of the memory are the other important parameters in
deciding the PLC speed of operation.
• Communication: Communication is an important requirement especially
in case of networking PLCs. If a PLC needs to communicate with another
PLC, I/O modules, operator interface, or any other devices, then the choice
of the communication requirement needs to be specified. In case of time-
critical applications of PLC, the choice of appropriate communication pro-
tocol is an important factor.
• Operator interface and software: Normally, for large-sized applica-
tions involving considerable number of I/O devices, operator interface
is provided to enable the operator to keep a constant update on the
PLC operation. Traditional operator interface includes push buttons,
pilot lamps, LEDs, and numeric display, but modern interfaces are
graphical display devices (usually PC monitor), which can display
graphical as well as text messages about the process status. Choice of
programming language is an important factor in deciding the choice
of the PLC.
• Physical environment: Industrial PLCs are usually located in the field
and hence their ability to withstand harsh environment is crucial in
deciding the choice of PLC. Protection against liquid and solid materials
is known by the term ‘ingress protection’, i.e., IP. Thus, a design engi-
neer must decide the required IP value of the enclosure for the PLC to be
chosen. Physical housing of the PLC along with its enclosure is decided
keeping in mind the maintenance, troubleshooting, and program modi-
fication issues.
2.6.2 Vendor Selection
A large number of PLC vendors are available in the market with various prod-
ucts having different features. Thus, choice of appropriate vendor is not an easy
task as it has to meet the industrial automation requirements. It should support
future expandability requirements and must provide a cost-effective solution for
the entire operational period. The final choice of vendor or supplier also depends
on its product functionality, existing customer feedback, availability of quick
support, comprehensive training for the technicians and engineers, systematic
Programmable Logic Controllers 67
offline mode, otherwise it may cause accident. The Force mode for LD is
shown in Figure 2.56.
• Print function: PLC print function is used for having hard copy printout
for a section or the entire program for debugging or for keeping record.
Printout for a section of the program or a continuous print can be taken
for the entire program. In case of ladder program, as each rung has a refer-
ence number, printout can be taken with cross reference number for easy
understanding.
2.6.5 Maintenance of PLC
Though PLCs are manufactured with the knowledge that they are going to be used
in harsh industrial environment, regular maintenance of PLCs is important for
smooth running of a plant; otherwise, downtime of the plant will cause a huge pro-
duction loss. Thus, preventive maintenance is a regular job for plant technicians
and engineers. A routine maintenance schedule increases the longevity of PLCs and
Apart from the above, any equipment or machinery causing heat dissipation, vibra-
tion, emission of volatile components, and EMI should not be placed in the vicinity
of the PLC cabinet. In addition, tagging of the wires and components should not be
disturbed.
Normally, two standard symbols are used for signifying different types of hazards
as follows:
two level switches (LHS1 and LLS1) are connected. In Tank 2, one level switch
(LLS2) is connected for sensing lower liquid level.
I/O for the two-tank level control system:
Input Output
LHS1, I: 1/0 = Level High Switch of Tank 1 O: 2/0 = Inlet solenoid valve to Tank 1
LLS1, I: 1/1 = Level Low Switch of Tank 1 O: 2/1 = Connecting solenoid valve
LLS2, I: 1/2 = Level Low Switch of Tank 2 between Tank 1 and Tank 2
I: 1/3 = Set point for Tank 1 O: 2/2 = Outlet solenoid valve of Tank 2
I: 1/4 = Set point for Tank 2
I: 1/20 = Start
I: 1/21 = Stop
Bit: 10:1/0 = Emergency stop
FIGURE 2.58 Ladder Diagram for two-tank liquid level control with PLC.
PROGRAM DESCRIPTION
• Rung 0001 – Master start/stop rung to Start/Stop the entire process.
• Rung 0002 – Controls connecting valve output O: 2/1. It is opened when
LHS1 I: 1/0, set point for Tank 1 I: 1/3 and LLS2 I: 1/2 are energized. O:
2/1 is closed when LLS1 I: 1/1 is energized, or in other words when Tank
1 is empty.
• Rung 0003 – Controls inlet valve O: 2/0. It allows the inlet flow by open-
ing inlet valve whenever LLS1 I: 1/1 is energized.
• Rung 0004 – Controls outlet valve with address O: 2/2. It allows the liq-
uid to flow out when set point for Tank 2 I: 1/4 is energized.
Input Output
LHS1, I: 1/0 = Level High Switch of Tank O: 2/0 = Inlet valve for liquid 1 to Tank
LLS1, I: 1/1 = Level Low Switch of Tank O: 2/1 = Inlet valve for liquid 2 to Tank
I: 1/20 = Start O: 2/2 = Outlet valve of Tank
I: 1/21 = Stop O: 2/3 = Stirrer motor of Tank
Bit: 10:1/0 = Emergency stop
PROGRAM DESCRIPTION
• Rung 0001 – Master start/stop rung to Start/Stop the entire process. By
pressing Start I: 1/20, inlet liquid valve O: 2/0 opens and liquid 1 starts
flowing into the tank until the level reaches to LLS1, I: 1/1, i.e., low-level
float sensor.
Programmable Logic Controllers 75
• Rung 0002 – Once LLS1, I: 1/1, i.e., low-level float sensor is energized,
inlet liquid valve O: 2/1 opens and liquid 2 starts flowing into the tank
until the level reaches to LHS1, I: 1/0, i.e., high-level float sensor.
• Rung 0003 – As LHS1, I: 1/0, i.e., high-level float sensor is energized,
Stirrer starts operation, and the Timer T0 starts counting for 60 sec. After
60 sec, T0 will be ON and stirrer stops working.
• Rung 0004 – Once T0 becomes ON, valve O: 2/2 will open and the
liquid mixture drains out from Tank.
• Rung 0005 – As outlet valve O: 2/2 opens, Timer T1 starts counting for
120 sec. After 120 sec, T1 will be ON and outlet valve O: 2/2 closes to
stop draining of mixture liquid.
Stop I: 1/21 switch is used to stop the process and in an emergency situation, to
stop the process, Emergency stop switch bit: 10: 1/0 can be pressed.
FIGURE 2.60 Ladder Diagram for liquid mixing control with PLC.
76 Industrial Automation Technologies
data migration from legacy systems. Unified HMI supports a number of network
communications which include ControlNet and DeviceNet. ControlNet is a real-
time, control layer network that provides high-speed transportation of both time-
critical I/O data and messaging data. DeviceNet is designed to connect industrial
devices such as limit switches, photoelectric cells, valve manifolds, motor starters,
drives, and operator displays to PLCs and PCs. A number of HMI software run on
Microsoft Windows CE, a version of the Windows operating system that is designed
for handheld devices. Windows CE allows users to deploy the same HMI software
on distributed HMI servers, machine-level embedded HMI, diskless open HMI
machines, and portable or pocket-sized HMI devices.
At present, most of the HMI screens are touch-sensitive for easy functionality.
They are available in various sizes depending on actual application. Operators and
users are increasingly moving toward high-performance HMI which ensures fast and
effective interaction. It helps the viewer to observe and respond to problems more
efficiently, as well as make better-informed decisions. High-performance HMI is
simple, clean, and purposely cleared of any extraneous graphics or controls. Its color,
size, and placement are used with discretion to optimize user experience. In today’s
scenario of mobile communication, remote monitoring of plant or process informa-
tion has become a standard practice. Mobile-based remote monitoring allows greater
flexibility and accessibility for process engineers. With this feature, an offsite control
system engineer can confirm the temperature of a warehouse on a portable device,
eliminating the need for onsite supervision after working hours. Checking a process
on the factory floor while being miles away from the facility has become a standard
practice. Additionally, it is becoming more common to send data from local HMIs
to the cloud, where it can be accessed and analyzed remotely, while keeping control
capabilities local. Future HMI technology is moving toward Augmented Reality and
Virtual Reality to visualize the manufacturing functions for its clear understanding
and hence quick and correct decision-making can be accomplished by a process
engineer.
need for switching the power off or restarting the system, i.e., it has hot-swapping
or hot-plugging feature. In case of multi-vendor configuration of PAC, PnP is a very
important feature for connecting individual modules, but this technology is still in
its development stage.
Now, at the field level of an automation network, most of the industrial automation
processes are run by PLC. So, to increase productivity with lesser operation cost,
PLCs are integrated with the ERP platform. In the early days, there was no such con-
nectivity but at present with Industry 4.0, PLCs have become an integral component
of ERP software.
PLCs are quite efficient to handle batch processes but their major drawback
is that they can’t store data. They are fed by sensors/switches regarding the real-
time plant status and provide necessary corrective measures, but they do not keep
a record of the data. Moreover, PLCs can’t convert the data into comprehensive
reports relating to production or extract useful information from the data for the
management, which helps in future decision-making. Hence, by integrating ERP
with PLC, many departments like management, production, maintenance, sales,
and marketing, etc. are getting benefited. The plant maintenance module of the
ERP system stores information about the functioning of various equipment along
with the PLC. For any necessary upgradation and fixing of various operational
issues, it would offer the ability to create proactive and preventive maintenance
plans. The maintenance schedule for each machine, as defined in the ERP system,
would be synchronized with the PLC system’s knowledge of the actual machine
condition. Thus, it helps in keeping the technical personnel one step ahead of any
possibility of a costly equipment failure.
Providing real-time/current information, in addition to historical information, the
integration of an ERP with a PLC system would increase the transparency and vis-
ibility in information availability, allowing the management to take timely decisions.
The end users would also gain a significant advantage from the automated data gen-
eration, as it would lessen the amount of time-consuming manual work and reduce
the possibility of mistakes. Hence, by integrating ERP with PLC, an automation
process is benefited in the following ways:
• Data collection and analysis: By use of IIoT, a large amount of data can be
collected from processes and equipment and placed in the ‘cloud server’ for
future study and trend analysis. The objective is to optimize and reorganize
the processes so that we can reduce the waste and to provide faster response
to customer demands.
• Faster business decision: Management has easy access to various types of
data related to the entire process (e.g., raw material procurement to market
demand) operation and hence business policy can be decided in a much
lesser time, which leads to competitive advantage.
• Enhanced networking: Conventional centralized PLCs will be replaced
by multiple smaller networked PLCs (micro and nano PLCs) that are placed
closer to the sensors they are monitoring and the mechanisms they are con-
trolling. Micro or nano PLCs designed to communicate as part of the IIoT
are emerging to fulfill this type of role, providing I/O channels a small
footprint with modular expansion options.
• Remote sensor data and PLC diagnostic data historian: By incorporat-
ing additional sensors to the PLCs, we can have the diagnostic data for the
PLC in any web or mobile browser from anywhere. This will help in early
maintenance to avoid any possible major failure of any equipment.
• Alerts: Email alerts can be set up for plant maintenance engineers when
diagnostics and sensor readings reach certain threshold values or any type
of abnormal behavior of the plant.
• Data visualization: Plant engineers have data visualization option from
any remote location containing graphs and charts for easy interpretation
and understanding.
82 Industrial Automation Technologies
With time, new features are being added to PLCs based on IIoT and it helps in attain-
ing new dimensions in PLC-based process automation technology.