You are on page 1of 63

Addis Ababa Science and Technology University

Programmable Logic Control (PLC)

1 / 63
Programmable Logic Control (PLCs)
1 Introduction to Relay control system
2 Programmable Logic Control (PLC)
PLC components
PLC Programming Languages
Elements of Ladder Diagram
3 PLC Digital Programming
Timers/Counters
Ladder Diagram (LAD) Programming
4 PLC Analog Programming
Conversion Operation
PLC Compare Instruction
5 Technical Specification

2 / 63
Introduction to Relay control system

Relay/Hard wired control systems

Relay controlled systems are hard-wired control system because


They are difficult to modify when production requirement
changes regularly. Any modification in control program
involves rewiring of the circuit
They are difficult to maintain because any small problem in
design could be a major problem in terms of tracing and
rewiring
Relays are used in hard wired control systems. For example: In
Electrical control, the wiring of control elements such as sensors,
solenoids, counters etc. are through relays control.

3 / 63
Introduction to Relay control system

Hard wired control systems consists of 3-parts

Input section: Consists of push buttons, switches and


sensors. They transfer signals to the processing section
Processing section: Consists of relay coils and contacts.
They determined the relationship between the inputs received
and outputs required
Output section: Consists of solenoids, lamps, and contactor
coils etc. The processed signals are transferred to this section.

4 / 63
Programmable Logic Control (PLC)

Programmable Logic Control (PLC)

PLC is a user friendly device designed to control the operation of


industrial equipment and processes.

PLC is one of industrial automation device designed to replace relay


logic boards (high costs and inflexible) which accepts input from a
series of sensors and sends output to actuators.

Although relays are used for control logic, they are still essential for
switching large power loads.

There are input and output ”relays” (implemented by transistors


rather than actual relays) that send and receive information from
the outside world. The outputs are set according to the inputs.

5 / 63
Programmable Logic Control (PLC)

PLC Circuits

6 / 63
Programmable Logic Control (PLC)

PLC
It is a special form of microprocessor-based controller that uses pro-
grammable memory to store instructions and to implement functions
such as logic, sequencing, timing, counting, and arithmetic in order
to control machines and processes

PLC is designed for multiple inputs and outputs arrangements, so It


can get the data from the sensors, and command the actuators.

Areas of applications
Manufacturing / Machining
Food / Beverage
Mining
Petrochemical / Chemical
7 / 63
Programmable Logic Control (PLC)

Advantages of PLCs
Wiring between input and output devices are done in the PLC
program, because relays lack flexibility
Troubleshooting aids make programming easier and faster to
make changes
Reliable components of PLC makes these to operate for years
before failure, because PLC’s are rugged and designed to
withstand vibrations, temperature , humidity and noise

Various PLC vendors exist:


Siemens
Rockwell
Mitsubishi
Schneider
Omron
Allen-Bradley
8 / 63
Programmable Logic Control (PLC)

Comparison between Relay and PLC

9 / 63
Programmable Logic Control (PLC)
PLC components

PLC Basic Components


PLC is essentially a microcomputer, tailored specifically for certain
control tasks.
Hardware: consists of the actual device technology, i.e. the
PCBs, integrated modules, wires, battery housing etc.
Firmware: is the software part stored in ROM, known as
executive software, that is permanently installed and supplied
by the PLC manufacturer. The internal program provided by
the manufacturer executes the user’s program. The executive
software determines
what functions are available to the user’s program
how the program is solved
how the I/O is serviced, what the PLC does during power up
and down and fault conditions
Software: is the user program which is stored in the RAM.
10 / 63
Programmable Logic Control (PLC)
PLC components

PLC Hardware Components

The major hardware compo-


nents are
1 Power Supply module
2 Input module
3 Central processing unit
4 Output modules
5 Programming Section

11 / 63
Programmable Logic Control (PLC)
PLC components

Power Supply Module


Usually input output modules require 24V DC and processor
require 5V DC. Usually power supply is integral part of PLC.
Power supply units convert 120/230 V AC line voltage to
standard supply of 24 VDC or 5V DC using standard rectifier
circuits
Input Module
Input devices include sensors, switches and push bottons. The
function of the input module is to covert high voltages from
input devices to low level logic voltages that the CPU uses
internally for processing
Input module can process both analog input and digital input. Ana-
log input module is used to convert analog signal form analog de-
vices like temperature sensors, pressure sensors etc. to digital signals
using ADC (Analog to digital convertor).

Analog signal is varying voltage in the range of 0-10 V or current in


the range of 4-20 mA. These values of current or voltage is converted
into integer value (say 16 bit word) 12 / 63
Programmable Logic Control (PLC)
PLC components

Digital input module is used to convert digital (24V/0V) input


to 5V/0V digital signals that CPU uses internally to execute a user
program.
Central Pocessing Unit
CPU controls and processes all operations within the PLC. The
CPU can perform various arithmetic and data manipulation
function with the local and remotely located Input/output
sections. It also perform many communication functions with a
personal computer and other PLCs
Output Modules
Output devices are actuators such as relay, solenoid coils,
lamps and motors. Output module amplifies the low level logic
signals generated by the CPU and pass these modified signals
to the final control elements to operate the output devices.

13 / 63
Programmable Logic Control (PLC)
PLC components

Connection of input-output devices with PLC

14 / 63
Programmable Logic Control (PLC)
PLC components

Circuit of Input module


It converts a high voltage signal to the 5V dc logic levels used on
the data bus. Basically the circuits condition the input to drive an
optocoupler. This electrically isolates the external electrical circuitry
from the internal circuitry. Other circuit components are used to
guard against excess or reversed voltage polarity.

15 / 63
Programmable Logic Control (PLC)
PLC components

Circuit of Output module


It must convert the 5Vdc logic levels on the PLC data bus to external
voltage levels. Basically the circuits use an optocoupler to switch
external circuitry. This electrically isolates the external electrical
circuitry from the internal circuitry. Other circuit components are
used to guard against excess or reversed voltage polarity.

16 / 63
Programmable Logic Control (PLC)
PLC Programming Languages

PLC Programming Languages

EN 61131-3 defines five PLC programming languages


Ladder Diagram (LD): graphic language derived from circuit
diagram of directly wired relay controls.
Function Block Diagram (FBD): functions and function blocks
are represented graphically and interconnected into networks.
Instruction List (IL): textual assembler-type language
consisting of an operator and an operand.
Structured Text (ST): high level language based on Pascal.
Sequential Function Chart (SFC): a language resource for the
structuring of sequence-oriented control programs.

17 / 63
Programmable Logic Control (PLC)
PLC Programming Languages

Examples
LD: Ladder Diagram

FBD: Function Block Diagram

ST: Structured Text


Sleeve-in : = (Part-TypeA OR Part-TypeB) AND Part-present
AND Drill-ok;
18 / 63
Programmable Logic Control (PLC)
PLC Programming Languages

IL: Instruction List:


LD Part-TypeA
OR Part-TypeB
AND Part-present
AND Drill-ok

ST Sleeve-in
SFC: Sequential Function Chart
Instruction List (IL) Mnemonics

IL Codes used differ to some extent from manufacturer to


manufacturer, and IEC 1131-3 is the proposed standard to unify IL
codes.
19 / 63
Programmable Logic Control (PLC)
Elements of Ladder Diagram

Elements of Ladder Diagram


There are five program elements/operations commonly used in PLC
ladder diagram

Bit logic operations


Timer Operations
Counter operations
Comparison operations
Conversion operations

Bit logic operation is for digital programming, where Comparison


and Conversions are used for analog programming. But we can use
timing and counting operations for both digital and analog program-
ming.
20 / 63
PLC Digital Programming

PlC Digital Programming


Bit logic operation: Some important programming elements for
bit logic operations are
NO contact
NC contact
Coil
Each of these elements can be selected from the program window.
NO and NC elements should not be confused with the hardware NO
and NC contacts of switching devices.

21 / 63
PLC Digital Programming

NO Contact of PLC

The NO contact scans for the signal state ON (1) at the specified
bit address.

Power flows through NO contact if the scanned bit address has a


signal state ON (1).

This contact is used for scanning the signal state of input devices
or output devices or other internal program elements such as timer
and counter.

22 / 63
PLC Digital Programming

NO PLC contact position using NO push button

23 / 63
PLC Digital Programming

NO PLC contact position using NC push button

24 / 63
PLC Digital Programming

NC Contact of PLC

PLC NC contact scans for the signal state OFF (0) at the specified
bit address.

Power flows through NC contact if the scanned bit address has a


signal state OFF (0).

NC contact is used for scanning the signal state of input devices or


output devices or other internal program elements such as timer and
counter.

25 / 63
PLC Digital Programming

NC PLC contact position using NO push button

26 / 63
PLC Digital Programming

NC PLC contact position using NC push button

27 / 63
PLC Digital Programming

Latch Circuit
Coil Sets a bit when the rung is true(1) and resets the bit when the
rung is false (0)
After being energized,
latch circuit
maintains that state.
If power fails, latch
rung will be
de-energized. When
power is restored,
machine will not
automatically
restarted, it can be
manually restarted by
pressing START
28 / 63
PLC Digital Programming
Timers/Counters

Timers/Counters

Timers/counters instructions results in internal outputs (in the form


of software modules) that provides the same functions as hardware
timers/counters.

These are used to activate or deactivate a device after an expired


intervals/counts.

Both of these require an accumulator to store the elapsed count/time


and a register to store the preset value.

Timers can be linked together, the term is cascade, to give larger


delay times than is possible with just one timer.

29 / 63
PLC Digital Programming
Timers/Counters

PLC Timers

Timer instructions used to create programmed time delays an output


for a certain time or wait a certain time before operating an output.

The number of timers that you can use in your user program is
limited only by the amount of memory in the CPU.

Each timer uses a 16 byte IEC − Timer data type DB structure


to store timer data that is specified at the top of the box or coil
instruction.

There are many types of timers but the most common types are
PLC on delay timer
PLC off delay timer

30 / 63
PLC Digital Programming
Timers/Counters

PLC on delay timer


The instruction Generate on-delay delays setting of the output Q by
the programmed duration PT.

The instruction is started when the result of logic operation (RLO)


at input IN changes from 0 to 1 (positive signal edge). The pro-
grammed time PT begins when the instruction starts.

When the duration PT expires, the output Q has the signal state
1. Output Q remains set as long as the start input is still 1. When
the signal state at the start input changes from 1 to 0, output Q is
reset.
31 / 63
PLC Digital Programming
Timers/Counters

The timer function is started again when a new positive signal edge
is detected at the start input.

The current time value can be queried at the ET output. The time
value starts at T #0s and ends when the value of duration PT is
reached. The ET output is reset as soon as the signal state at the
IN input changes to 0.

32 / 63
PLC Digital Programming
Timers/Counters

33 / 63
PLC Digital Programming
Timers/Counters

PLC off delay timer

The instruction Generate off-delay delays resetting of the output Q


by the programmed duration PT. The Q output is set when the
result of logic operation (RLO) at input IN changes from 0 to 1
(positive signal edge).

When the signal state at input IN returns back to 0, PT starts.


Output Q remains set as long as the duration PT is running. When
duration PT expires, the Q output is reset.

If the signal state at the IN input changes to 1 before the duration


PT expires, the time is reset. The signal state at the output Q will
continue to be 1. The current time value can be queried at the ET
output.

34 / 63
PLC Digital Programming
Timers/Counters

The time value starts at T #0s and ends when the value of dura-
tion PT is reached. When the duration PT expires, the ET output
remains set to the current value until input IN changes back to 1.

If input IN switches to 1 before the duration PT has expired, the


ET output is reset to the value T #0s.

35 / 63
PLC Digital Programming
Timers/Counters

PLC Counters
Counters are used to detect pieces numbers and events. There are
two basic counter types a) Count Up (CTU) b) Count down (CTD)

Example: When the input to count up counter goes true the accu-
mulator value will increase by 1. If the accumulator value reaches
the preset value the counter bit will be set.

A count down counter will decrease the accumulator value until the
preset value is reached.

36 / 63
PLC Digital Programming
Timers/Counters

Count Up
The CTU counter counts up by 1 when the value of parameter CU
changes from 0 to 1. The CTU timing diagram shows the operation
of unsigned integer count value (where PV = 3).
If the value of parameter CV (current count value) is greater
than or equal to the value of parameter PV (preset count
value), then the counter output parameter Q = 1.
If the value of the reset parameter R changes from 0 to 1,
then the current count value is reset to 0.

37 / 63
PLC Digital Programming
Timers/Counters

Count Down
The CTD counter counts down by 1 when the value of parameter CD
changes from 0 to 1. The CTD timing diagram shows the operation
for an unsigned integer count value (where PV = 3).
If the value of parameter CV (current count value) is equal to
or less than 0, the counter output parameter Q = 1.
If the value of parameter LOAD changes from 0 to 1, the
value at parameter PV (preset value) is loaded to the counter
as the new CV (current count value).

38 / 63
PLC Digital Programming
Timers/Counters

Procedure for programming

39 / 63
PLC Digital Programming
Ladder Diagram (LAD) Programming

LAD Programming
The ladder diagram provides graphic display of program flow and
strongly resembles to relay logic. It provide a method to symbolically
show how relay control schemes are implemented.

The ladder diagram consists of two vertical lines representing the


power rails, and circuits are connected as horizontal lines.

40 / 63
PLC Digital Programming
Ladder Diagram (LAD) Programming

PLC Ladder Programming Conventions

The vertical lines of the diagram represent the power rails


between which the circuits are constructed.
Each rung on the ladder defines one operation in the control
process.
A LAD is read from left to right and from top to bottom.
Each rung must start with an input/s and must end with at
least one output.
Electrical devices are shown in their normal conditions, e.g. a
normally closed switch is shown closed.
A device can appear in more than one rung of a ladder.
The inputs and outputs are all identified by their addresses,
the notation used depending on the PLC manufacturers.
41 / 63
PLC Digital Programming
Ladder Diagram (LAD) Programming

Rail, Rungs and Power flow in Ladder diagram

42 / 63
PLC Digital Programming
Ladder Diagram (LAD) Programming

Example1
Switching a lamp using push button using Omron PLC

43 / 63
PLC Digital Programming
Ladder Diagram (LAD) Programming

LAD for motor start-stop

44 / 63
PLC Digital Programming
Ladder Diagram (LAD) Programming

Example for OFF Delay Timer


Enabling the indicator to be ON immediately when switch pressed
and OFF after a 5 sec delay by the switch.
Number of PLC Inputs Required
X1 – Start Switch.
Number of PLC Outputs Required
Y1 – Output Indicator
Number of PLC Timer Required
T0 – 5 second Timer, 100 ms Time Base. (K50 Preset Value for
Timer)

45 / 63
PLC Digital Programming
Ladder Diagram (LAD) Programming

PLC Ladder Program Description

46 / 63
PLC Digital Programming
Ladder Diagram (LAD) Programming

Example for ON Delay Timer

Enabling the indicator to be ON after a 3 sec delay when switch


pressed and OFF immediately by the switch.
Number of PLC Inputs Required
X1 – Start Switch.
Number of PLC Outputs Required
Y1 – Output Indicator
Number of PLC Timer Required
T0 – 3 second Timer, 100 ms Time Base. (K30 Preset Value for
Timer)

47 / 63
PLC Digital Programming
Ladder Diagram (LAD) Programming

PLC Ladder Program Description

When X1 = ON, TMR instruction will be executed. Timer T1


will be ON and start counting for 3 sec. When T1 reaches its
set value, the NO (Normally Open) contact T1 will be
activated and indicator YI will be ON.
When X1 = OFF, TMR instruction will not be executed.
Timer T1 will be OFF and so will NO contact T1. Therefore,
the indicator Y1 will be OFF.

48 / 63
PLC Digital Programming
Ladder Diagram (LAD) Programming

Example for ON Delay and OFF Delay Timer


Enabling the indicator to be ON after a 5 sec delay and OFF after
a 3 sec delay by the switch.
Number of PLC Inputs Required
X1 – Start Switch.
Number of PLC Outputs Required
Y1 – Output Indicator
Number of PLC Timer Required
T0 – 5 second Timer, 100 ms Time Base. (K50 Preset Value for
Timer)
T1 – 3 second Timer, 100 ms Time Base. (K30 Preset Value for
Timer)

49 / 63
PLC Digital Programming
Ladder Diagram (LAD) Programming

PLC Ladder Program Description


When X1 = ON, T0 will start counting for 5 sec. When T0
reaches its set value, the NO contact T0 will be ON while NC
contact T1 will remain OFF, which makes the indicator Y1 to
be ON and latched.
When X1 = OFF, T1 will start counting for 3 sec. When T1
reaches its set value, the NC contact T1 will be activated
while the NO contact T0 will remain OFF, which makes the
indicator Y1 to be OFF.

50 / 63
PLC Digital Programming
Ladder Diagram (LAD) Programming

Example
The process of making tea every day in the morning for seven days
(water in the tank is enough for 7 days) is given in the figure below

51 / 63
PLC Digital Programming
Ladder Diagram (LAD) Programming

Procedure
When pressing the start button, valve1 (V1) opens, so the water
pass through the valve to the heating tank.

When the water level reaches the float switch (FS), the valve should
close and heating must begin.

When the temperature reach the required level the thermostat dis-
connects the heater element E and opens valve2 (V2) for 10 seconds
then the alarm bell B is activated to show the sign that tea is ready.

52 / 63
PLC Analog Programming

PLC Analog Programming


In contrast to binary signals that can assume only the two signal
states ”Voltage present +24V” and ”Voltage not present 0V”, ana-
log signals within a certain range can assume any number of values.

Some examples of analog variables in control engineering:


Temperature −50... + 150o C
Flow 0 ... 200l/min
Speed 500 ... 1500 r/min
Using a transducer, these variables are converted into electrical volt-
ages, currents or resistances.

For example: The speed range of 500 ... 1500 r/min can be con-
verted by means of a transducer into a voltage range of 0 ... +10V.
If a speed of 865 rpm is measured, the transducer would read out a
voltage of +3.65 V. 53 / 63
PLC Analog Programming

In order to process the signal, voltages, currents or resistances are


connected to an analog module to digitalizes the signal using ADC.
Therefor, 3.65V is stored in a series of binary digits as information.

The more binary digits are used for digital representation, the finer
is the resolution. with 1 bit, the range is divided into 2; 0...+5V
or +5V ... +10V. With 2 bits, the range can be divided into 4
individual ranges; i.e. 0 ... 2.5/2.5 ... 5/5 ... 7.5/7.5 ... 10V

54 / 63
PLC Analog Programming

Data types processed by PLC

55 / 63
PLC Analog Programming

Note: For analog value processing, the data types ’INT’ and ’REAL’
play an important part since entered analog values are present as
integers in the format ’INT’ and for accurate further processing,
only floating point numbers ’REAL’ can be used because of the
rounding off error in the case of ’INT’.

56 / 63
PLC Analog Programming
Conversion Operation

Conversion Operation

This operation is very important for analog signals, such as temper-


ature and level signals processing

There are two basic conversion operations


Normalizing Instructions
Scaling Instructions

57 / 63
PLC Analog Programming
Conversion Operation

Normalizing Instructions
If an analog input value is present as digitalized value, it usually
has to be normalized so that the numerical values correspond to
the physical values in the process. Likewise, the analog output to
the output word usually takes place only after the output value is
normalized.

Normalizes the parameter VALUE inside the value range specified


by the MIN and MAX parameters:

OUT = (VALUE − MIN)/(MAX − MIN)


Where (0 ≤ OUT ≤ 1.0)
Scaling Instructions
Scales the normalized real parameter VALUE where (0.0 ≤ VALUE ≤
1.0) in the data type and value range specified by the MIN and MAX
parameters: MIN ≤ OUT ≤ MAX
OUT = VALUE (MAX − MIN) + MIN
58 / 63
PLC Analog Programming
PLC Compare Instruction

PLC Compare Instruction


Compares two values of the same data type. When the LAD contact
comparison is TRUE, then the contact is activated.

The SIMATIC S7-1200 compare instructions

59 / 63
PLC Analog Programming
PLC Compare Instruction

Example: normalizing and scaling an analog input value


An analog input from an analog signal module or signal board using
input in current is in the range 0 to 27648 for valid values. Suppose
an analog input represents a temperature range from -30 to 70 o C
where the 0 and 27648 represents -30 and 70.0 o C , respectively.

Normalize the input to a value between 0.0 and 1.0, and then scale it
between -30.0 and 70.0 o C . The resulting value is the temperature
represented by the analog input in o C :

60 / 63
PLC Analog Programming
PLC Compare Instruction

Example: normalizing and scaling an analog output value


An analog output to be set in an analog signal module or signal
board using output in current must be in the range 0 to 27648 for
valid values. Suppose an analog output represents a temperature
range from -30.0 to 70 o C where the 0 and 27648 represents -30.0
and 70.0, respectively.

Normalize the value in engineering units to a value between 0.0 and


1.0, and then scale it to the range of the analog output, 0 to 27648:

61 / 63
PLC Analog Programming
PLC Compare Instruction

Example of tank level control

62 / 63
Technical Specification

Technical Specification Analog Input

63 / 63

You might also like