EAB4223/EEB 5223 Industrial Automation and Control System
• PART 2: Automation and PLC. PLC. Assoc Prof Dr Nordin Saad Department of Electrical & Electronics Engineering Univ Univer ersi siti ti Tekn Teknol olog ogii PETR PETRON ONAS AS 23.03.005 Email:
[email protected] Tel: 05-368 7835
This topic covers covers the key and base areas of automation. automation. The learning approach used is the mixed-mode delivery comprises of lecture-tutorial-lab activities..
Learning LearningOutcomes Outcomes
Synopsis Synopsis This Thiscourse coursecover covertopics topicsrelated relatedto tomeasurements measurements (PLTF) and automation in the process (PLTF) and automation in the processindustry. industry.These These include a study on industrial sensors and actuators, include a study on industrial sensors and actuators, industrial industrialcontrollers controllerssuch suchas ascomputer-based computer-basedcontrol, control, PLC , DCS and FF. PLC , DCS and FF.
Process Instr.& .& Meas. Process,,Industrial Industrial Instr Instr.& Meas. The learning outcomes related to Industrial instruments and Measurements • Have Have know knowle ledg dge e and and understanding of the various process industry instruments, concept of measurements, calibration and configuration requirements and their applications. • Be able able to des desig ign n and and d dev evel elop op a control loop consisting the process instruments, based on a prescribed requirement.
that thatstudents studentsare areexpected expectedto toachieved achievedafter after successfully completing the course successfully completing the course
Automation Automation
DCS DCSand andFoundation Foundation Fieldbus Fieldbus
The learning outcomes related to Automation and the implementation of Programmable logic controller
The learning outcomes related to DCS and Foundation Foundation Fieldbu Fieldbus s use in process industries.
• Have ave kno know wledg ledge e and and understanding of the PLC architecture and its importance in automation.
• Have ave kno know wledg ledge e and and understanding of a DCS and its use in process industries, and the features and architecture of a Foundation Foundation Fieldbu Fieldbus s system, and and its improvement over the conventional DCS.
• Be able able to d dev evel elop op a PLC PLC prog progra ram m to perform sequential, and batch control.
Objectives The focus of this topic: •develop sequence diagram for a given problem description involving electro-pneumatic actuators, sensors and electrical actuators (motor and etc), and field devices. •develop and implement a ladder diagram for a process in a manufacturing plant, batch process, and robotic system. Batch process S Electro-pneumatic Robotic System e n s o r Manufacturing system s
Prog ramming!!! Prog ramming!!!
C L P
CONTENTS
• Overvi Overview ew of Auto Automat mation ion •Programmable Logic Controller •Development of Ladder diagram and, •Several examples
What is ‘Automation’? • Automation is the ability of a system and/or devices to perform work intelligently with minimum or without human supervision or intervention. It is a system designed to extend the capacity of machines to perform tasks formerly done by human, human, and to control sequences of operation without human intervention.
Continue…
What is ‘Automation’? The term Automation also been used to describe non-manufacturing system in which programmed or automatic devices can operate independently or nearly independently of human control. control. In the fields of communications, aviation, or astronautics, for example, such devices as automatic switching equipment, automatic pilots, and automatic guidance control systems are used to perform various operations much faster or better that could be accomplished by humans.
Why need ‘Automation’? • To increase product standards with consistent quality. - increased increased production production and lowered lowered costs, costs, thereby making goods available to more people with better quality. • To gain higher throughput. - more can be be produce produced d at lower costs, costs, thus thus allows wages to increase which leads to the increas increasee of work workers ers’’ mot motivat ivation. ion. • To reduce labor dependencies.
Who need ‘Automation’? • Small and medium scale industries (SMIs) in the manufacturing sectors. SMI could benefit from low cost automation to replace repetitive process usually carried out by human. • Multinational companies (MNC). Current technology allows almost every aspect of manufacturing process can be automated, hence reducing dependencies on production workers and at the same time increasing productivity and quality.
Where does ‘Automation’ apply to? • Assembly line • Test and finishing packaging (repetitive process) • Hazardous environment • High speed and precision process, and management. • Computerized-plant management.
Benefits of automation: • Cost reduction in terms of labor requirement • Increase efficiency in terms of Quality and Quantity • Flexible to market demand (faster and flexible). i.e., changes in product and changes in process • Reliable – auto automati mation on proce processes sses can sust sustain ain long hours but still maintaining its desired performance (consistent quality and durability). • High repeatability • Safe • A solution for labor shortage
Examples of ‘Automation’? • Industrial: Camera inspection Mark and Lead Test inspection Pick and place system Conveyor system Automatic packer sorter Automatic bonding machine Die-attached machine.
Public utilities: utilities : Traffic light
Domestic:
Automatic gate Washing machine
Commercial: Office Automation Intelligent building Lifts and escalators Automatic Teller Machines (ATM)
What is a PLC? • A PLC is a computer computer,, having connections to external inputs and outputs.. outputs • The The prog progra ram m of of a PLC PLC ha hass the task to set the outputs, i.e. depending on the inputs,, the outputs inputs outputs,, and the program program..
CONTROL DEVICES 1. Mechanical co control-cam, go governor, et etc. 2. Pne neum umaati ticc co contr trol ol-c -co ompre ress sseed air air,, val valv ves es,, et etc. 3. Ele lecctr tro ome mecchan anic ical al cont ntro roll-sswi witc tch hes es,, re rela lays ys,, timers, counters, etc. 4. El Elec ectr tron onic icss co cont ntro roll-si simi mila larr to el elec ectr trom omec echa hani nica call control, except uses electronic switches 5. Computer control •
Programmable Logic Controller
FUNCTIONS OF CONTROLLERS 1. 2. 3. 4.
On-off control Sequential control Feedback control, and Motion control
PROGRAMMABLE LOGIC CONTROLLER A substitute for hardwired relay panels. “ A digitally operating electronic apparatus which uses a programmable memory for the internal storage of instructions by implementing specific functions such as logic sequencing, timing, counting, and arithmetic to control, through digital or analog input/output modules, various types of machines or processes. The digital computer which is used to perform the functions of a programmable controller is considered to be within this scope. Exclude are drum and other similar mechanical sequencing controllers.” controllers.” National Electrical Manufacturing Association (NEMA ( NEMA)) 1968
The Design criteria for the first PLC, specifie specified d in 19681968- Hydraul Hydraulic ic Divis Division ion of General Motors Corporation -The SpecificationPurpose - To eliminate the high cost associated with inflexible relay-control relay-controlled led systems.
A solid-state system with computer flexibility Capable of surviving industrial environment Able to be easily programmed and maintained by plant personnel To be re-usable re-usable..
The first PLC appeared in early 1970s. Merely Mere ly ‘rela ‘relay y repl replace acement ment’’ mach machines ines.. Other capabilities were later added, e.g., Counters, Timers, Arithmetic, Text handling, Analogue signal handling, and PID control
TRADITIONAL AREA OF PLC APPLICATION IS THAT OF SEQUENTIAL CONTROL
PLC improves production efficiency. The present state of intense industrial competition requires that:
• The speed of the • Minimising production downtime of equipment and production production line can equipment. be set up. cost production • L o w • Lowering material equipment. and labor cost of a product • Improving quality and lowering rejects.
PLC meets most of the above needs… • Tradit Tradition ionall ally, y, autom automati ation on is only only appli applica cable ble to single item high volume production • Now, Now, nece necessa ssary ry to to auto automat matee prod product uction ion of of multiple variety of products, in moderate quantity, as well as achieving higher overall productivity productivity and requiring minimum investment in plant and equipment. • FMS answer answerss thes thesee need needs. s. The system system includes, NC machines, industrial robots, automatic transports and computerized control of production. PLC in the use of most automated production equipment.
Electromechanical Control Advantages Standardised components Insensitive to interference Inexpensive for small system Short-term overload capability
Disadvantages High operating costs Modifications are difficult Unclear system layout Wear (maintenance therefore required) High space requirements Expensive components
Electronic Control Advantages High reliability after earlier development problems. Extremely high operating speed. Low space requirements. Low power consumptions. No moving parts. Low costs.
Disadvantages Frequent failures in the initial phase. Unclear layout Modifications are difficult. Highly paid specialists are required.
Programmable Controls (PLCs) Advantages High reliability after earlier development problems.
Disadvantages No uniform programming language.
Slower than parallel logic system since Simple trouble-shooting, trouble-shooting, due to plug-in processing is carried out cyclically. design. Simple installation. No standard standardisati isation on requ required ired (means (means more flexibility). Low space requirements. Low power consumption. No moving parts. Rapid modification of program. Production and programming can be carried out in parallel.
Comparison Wired logic and PLC Wired Logic
PLC
Control device (Hardware)
Specific purpose
General purpose
Control Scale
Small and medium
Medium and large
Change or addition of specification
Difficult
Easy
Delivery period
Several days
Almost immediate
Maintenance (by makers and Difficult users)
Easy
Reliability
Very high
Economic efficiency
Depend on design and manufacturer Advantage on small scale operation
Advantage on small, medium and large scale scale operation
A typical control system INPUT DEVICES Selector switch Pushbuttons Photoelectric switches Limit switches Circuit breakers Proximity switches Level switches Motor starter contacts Relay contacts etc.
CONTROLLER
Relays Timers Counters Logic Units Mechanical Cams etc.
OUTPUTS
Alarm Control relays Fans Lights Horns Valves Motor starters Solenoids etc.
R R E E P P L A L A C C E E D D B B Y Y
Programmable Programmable Logic Logic Controller Controller
Applications Control Type
Functions
Sequence control
Auto/Semi-auto manual control of machine/process
Sophisticated Control
Analog control (T,P,F,L, etc) Servo motor control Stepper motor control
Supervisory control
Process monitoring and alarm Fault diagnosis and monitoring F.A., F.M.S., C.I.M. etc.
TRADITIONAL VS PROGRAMMABLE CONTROL SYSTEMS Conventional controller
Controlled plant
Programmable Logic Controller
Controlled plant
S1
+ S2
K1
Its behavio behaviour ur depend dependss on the wiring wiring arrangements
S1 m a r g o r p l o r t n o c a s d l o h y r o m e M
+ Input 1 S2
+ Input 2 K1 Output 1
-
Its beha behavio viour ur dep depends ends on on the instruction stored in memory
PLC replaces most of the relay panel wiring by software programming
Electrical connections to a PLC Each PLC has three sets of terminals through which it connects to the plant/industrial processes.
Note:
Input devices
Power terminals
θ
P >
Input terminals
240 VAC INPUT 1
PE N
L
INPUT 2
INPUT 3
PLC
N L
COMMON
OUTPUT 1
OUTPUT 2
OUTPUT 3
Output terminals Output devices
INPUT DEVICES Ρ >
θ
a. pushbutton
b. Selector switch
c. Thermostat
d. Pressure switch
K
e. Level switch
f. Relay contact
g. Proximity sensor
h. Photoelectric Photoelectric sensor.
OUTPUT DEVICES
a. Contactor coil
b. Relay coil
d. Signal lamp
c. Valve coil
e. Hooter
TYPES OF SWITCHES Selector switch
RATING:
Pushbutton switches
24 Volts AC/DC
Photoelectric switches
48 Volts AC/DC
Limit switches
120 Volts AC/DC
Proximity switches
230 Volts AC/DC
Level switches Thumbwheel switches
TTL level (Transistor-totran transi sist stor or +/+/- 5V) 5V)
Slide switches
Isolated Input
How PLC works? Conventional relay/contactor control systems perform all controlling processes at the same time. In a PLC the program sequence is executed step by step and is repeated cyclically. Input Inputlevel level (Reactions) Reads in inputs and transfers the value to a memory area
Processing Processing (Details)
The given commands (program) will be executed step by step
Output Outputlevel level
The outputs are set according to results of the processor
Common Structure of a PLC Input devices send signals into the controller
Input circuits The processor takes its instructions from the memory
Memory
Micropro cessor (CPU)
P o w e r s u p p l y
The power supply serves the controller with a variety of stable direct voltages
Output circuits
Output devices receive signals from the controller
PLC COMPONENTS 1.
Proc rocessor
Micro icrop proc rocessor based, may allow llow arith rithm metic tic operati ratio ons, logic operators, block memory moves,computer interface, local area network, functions, etc.
2.
Memory
Measured in words (2 bytes) ROM RAM PROM EEPROM EPROM EAPROM and Bubble Memory.
THE DIFFERENT AREAS IN MEMORY , AND THE FUNCTIONS 1. SYSTEM MEMORY
• Exe Executi cutive ve-- A per perma mane nent ntlly sto stored red col olle lect ctio ion n of supervisory programs to direct system activities e.g., program execution, communication with other devices, and fault diagnosis. • Scratch pad- A temporary store used sed by the CPU to store small amount of data generated during program execution.
THE DIFFERENT AREAS IN MEMORY , AND THE FUNCTIONS
2. APPLICATION MEMORY • Data ta table ar area- Thi hiss ho holds th the Use Userr Pr Program, a Data Table for counter and timer preset values and the Input/Output Table. INPUT TABLE OUTPUT OUTPUT TABLE TABLE INTERNAL STORAGE BITS
Also known known as ‘Markers’ ‘Markers’ , ‘Flags’, ‘Flags’, ‘Internal ‘Internal outputs’, ‘Internal coils’, Internal control relays’. They do not operate any external devices, instead used for latching and interlocking purposes in the control program.
STORAGE REGISTERS CONTROL PROGRAM INSTRUCTIONS
A group of bits holding information in binary, BCD, or ASCII format. Values e.g., timer presets and accumulated values, counter presets and accumulated values, compare set points, maths operation results and ASCII characters.
PLC PL C COMP COMPONE ONENT NTS S … co cont ntin inue ue 3.
I/O
Modular plug-in peripheral AC voltage input and output DC voltage input and output numerical input and output special-purpose modules, for eg. High speed timers, and stepping motor controllers.
4.
Power supply
AC Power
5.
Peripheral
Hand-held programmer (HHP) Operator console Printer Graphic processor Simulator Network communication interface
ANALOG I/Os Analog inputs: Flow sensors, humidity sensors, potentiometers, pressure sensors, temperature sensors.
Analog outputs :
Analog meters, analog valves and actuators, DC and AC motor drives.
SOME SPECIAL I/Os Thermocouple input : Low level analog signal, filtered, amplified, and digitized before sending to the processor through I/O bus. Fast input: 50 to 100 microsecond pulse signal detection. ASCII I/O: Communicates with ASCII devices. Stepper motor output: Provide directly control of stepper motor. Servo interface:Control DC servo motor for point-topoint control and axis positioning. PID control : The Proportional Integral Derivative is used for closed loop process control. Network module.
The Technical features Input
Output
a.
Number of external inputs
b.
Types of external inputs
a.
Number of external outputs
b.
Types of external outputs
Auxiliary relays a.
Number of output relays/holding relays etc.
Counters
a.
Number of counters
Timers
a.
Number of timers
Memory
a.
RAM
b.
EPROM
c.
EEPROM
a.
Handheld programming console
b.
L.S.S.- Ladder Support Software
c.
G.P.C. Graphic Programming Console
d.
F.I.T. Factory Intelligent Terminal
Peripherals
PLC WIRING DIAGRAM DC Power supply
PLC A B
01 02
01
02
+ HR20
03
External
+V 11
HR20
12 HR20
11
switches -V
Stored program
MTR
Isolation Inputs and outputs are electrically separated (no electrical connection), using - opto-e opto-elec lectro tronic nic couple couplerr
Or
-or electromechanical relay
INPUT CONNECTIONS DC Power Supply
L1
L2 AC input devices
+
DC Power Supply
+
-
+V
1
1
1
2 3
2
2
3
3 -V
COMMON
(a) AC 120 or 230VAC, e.g., AC input modules convert signal sig nalss to logi logicc ‘1’ ‘1’ or ‘0’ ‘0’ state
DC input GND devices
(b) DC High DC
(c) TTL Low level DC (compatible with TTL)
OUTPUT CONNECTIONS DC Power Supply
L1
L2
+
-
L1
+V
1
1
2
2
3
3 -V
DC Power Supply
+
+V
1 2 3 -V
GND
(a) AC output module interface logic signal from processor with a AC output field device : voltage 120 or 230 VAC.
(b) DC output module interface logic signal from processor with a DC output field device : voltage > +5 V.
(c) TTL TTL output module interface logic signal from processor with a TTL compatible voltages
CONNECTING FIELD DEVICES TO DC Input/Output modules. Two common types of field circuits operate in the ON/OFF switching condition. a.
Contact circuits- e.g., relays operate in the ON/OFF condition as their mechanical contacts open or close.
b.
Solid state circuits- common use of transistor transistor (ON- saturation saturation)) (O (OFF-cu FF-cutoff) toff)
Sinking input module Turning Turning ‘ON” ‘ON” PNP produces produces a positiv positivee DC at output lead of field device
DC input module
+ DC power supply
-
+V Output
Switching element PNP
Sinking input terminal
DC common ‘1’ state: state: +DC +DC volta voltage ge
Sourcing input module Turning Turning ‘ON” NPN produces produces a very low low DC at output lead of field device. ‘1’ ‘1’ stat state: e: near ground potential
+ DC power
supply
-
Output DC comm common
Switching element NPN
Conventional current
DC input module +VDC Sourcing input terminal
Types of outputs a. Open co collector NPN – current sink sinkiing b. Open pen col olllecto ectorr PNP – curre urrent nt sou sourcin rcing g Current sinking: the load (field device) is connected bet. the output and the positive lead of the P/S. To +V DC +VDC Output
Conventional current
Field device
DC Common Switching element
NPN transistor
Sinking output outpu t terminal
DC Power Supply
To DC common
Current sourcing: the load (field device) is connected bet. the output and the negative common lead of the P/S. Sourcing output terminal To +V DC + V DC
Conventional current
Output DC Common
Switching element PNP transistor
Field device To DC common
Scan Time Scan time: The process of reading the inputs, executing the program and updating the outputs. Scan time is normally a continuous and sequential process of reading the status of inputs, evaluating the control logic and updating the outputs. Scan time indicates how fast the controller can react to field inputs and correctly solve the control logic.
I/O Update
Program scan
What is a SCAN Cycle? A
PLC resolves the logic of a ladder diagram (program) rung by rung, from the top to the bottom. Usually,
all the outputs are updated based on the status of the internal
registers. Then
the input states are checked and the corresponding input registers are updated. Only
after the I/Os have been resolved, is the program then executed. This process is run in an endless cycle. The
time it takes to finish one cycle is called the scan time. In some controllers contr ollers the idle state state is eliminated. eliminated. In this case, case, the scan time varies varies depends on the program length.
Begin Idle
Output
SCAN cycle
Input Resolve logic
Factors influencing scan time Scan time (time required to make a single scan) vary between 1 ms to 30 ms. The use of remote I/O subsystems increases scan time: having to transmit the I/O update to remote subsystem. Monitoring Monitoring of the control control program program adds overh overhead ead time to the scan: the micro has to send the status of the coils and contacts to the display (CRT) or other monitoring devices.
Types of PLC Programming Language The IEC 1161-3 Standard
a.
Structured te text pr programming (ST)- A high level language that has some similarities to Pascal. Statements can be used to assign values to variables
b. Logic diagram – A graphical language , and most widely used. Use Boolean mnemonics to represent the process, before converting into logic diagram. c.
Funct Fun ctio ion nal Blo lock ck Dia iagr gram am Pro rogr gram ammi min ng (FBD) – A graphical language . Used in applications involving the flow of signals between control blocks.
d. Instruction Li List (IL)- A low level programming language, much like assembly language programming. e.
Sequential Function Chart (SFC)- A graphical programming method. Very useful for describing sequential type processes .
LADDER DIAGRAM A ladder diagram is a means of graphically representing the logic required in a relay logic system, representing +V and 0V Consists of a number of rungs connecting two vertical lines. +V
PB1
PB2
R1
0V Rail
Rail R1 Rung R1
A
Programming a PLC The General Rule
SET
RESET
OUTPUT
LATCH
We’ll use the general rule to create the ladder diagram. More examples in lecture and tutorial…
PLC Ladder Diagram INSTRUCTIONS
1. Relay 2. Timer and Counter 3. Program Control 4. Arithmetic 5. Data Ma Manipulation 6. Data Transfer, and 7. Others, such as as se sequencers.
RELAYS A switch whose operation is activated by an electromagnet. contact
A Relay consists of two parts, the coil and the contact.
coil input
Relay coil
Output contact
R1
R1
Contacts:
Coil:
a. Normally lly open
a. Coil
b. Normally clos losed
b. Negative ive coil
LOGIC STATES ON: TRUE, contact closure, energize, etc. OFF: FALSE, contact open, de-energize, etc. Do not confuse the internal relay and program with the external switch and relay. Internal symbols are used for programming, External devices provide actual interface. (In the the notes notes we use use the the symbol symbol “~’ “~’ to represent negation. AND and OR are logic operators).
AN EXAMPLE OF RELAY LOGIC For a process control, it is desired to have the process start (by turning on a motor) five seconds after a part touched a limit switch. The process is terminated automatically when the finished part touches a second limit switch. An emergency switch will stop the process any time when it is pushed. EMERGENCY STOP) PB1 (EMERGENCY
LS1
LS2
TIMER 5 R1
R2 (MOTOR)
Rung 1: R1=(LS1+R1).(~PB1.~LS2) Rung 2: R1 (delayed 5 seconds)
LS1
PB1 LS2
R1
R1
R1
TIMER
PR=5
R2
EXAMPLE: CONTROLLING A CONVEYOR BELT PARTS BIN
FREE STANDING STANDING CONVEYO CONVEYOR R
INFRA RED THROUGH BEAM
REJECT SOLENOID
CONVEYOR MOTOR
st
INFRA RED REFLECTIVE
Programming a PLC
The General Rule
SET
RESET
OUTPUT
LATCH
A very very important rule!!! As we’ll see….
Program 1: When START switch (st) is energized, conveyor will move. If switch (st) is de-energized, the belt will still moving until sensor (infra red through beam) is blocked. TIMING DIAGRAM
mct
HRMC
mc-
LADDER DIAGRAM
st
s0
HRMC
mc HRMC
st HRMC
mct
s0 HRMC
SET=st HRMC=(st+HRMC).s0 RESET=s0
mct mc-
HRMC HRMC
Program 2: When START switch (st) is energized, the conveyor will move. It will stop 1.5 sec after the infra red through sensor is blocked by part on the belt. mct HRMC
1.5s
mc-
mc st s0 TIM01 tim01
HRT1
Set=s0 Reset=tim01
HRMC
Set=st Reset=tim01
mct
HRT1=(s0+HRT1).tim01 HRMC=(st+HRMC).tim01 mct=HRMC
FLOW CHART A pictorial representation of the sequence of operations to be carried out. Different shaped boxes are used to represent different actions. PROCESS BOX DECISION BOX
ACTIVATE RELAY R1
LS1 active ?
TERMINATION BOX CONNECTOR
START
A
Flow Chart …example. Translate into ladder diagram
START
L1
P1
no L1 active
yes
?
no
L2 active ?
P1 active ?
no yes
L3 active ?
ACTUATE RELAY R1
A
L2
L3
R1
LOGIC DIAGRAM The Internati International onal Standard Standardss Organisatio Organisation n (ISO) symbols: symbols:
NOT
1
NOR
>1 T=A’ AND
&
T=A.B
NAND
&
=1
T=A+B EX-OR T=A.B’+B.A’
T=(A.B)’ Inhibition
OR
>1
T=(A+B)’
&
T=A.B’ R-S Flip-flop
S R
Y Y’
Example: The use of a logic diagram A process: “If limit switch L1 AND key P1 are activated, OR, NOT limit switch L2 AND limit switch L3 are activated, then relay R1 is activated.” Expressed by a single Boolean equation: L1.P1 + L2.L3 = R1 The logic implementation of this function into a form required for input into PLC. L1
&
P1 L2 L3
1 1
&
R1
SEQUENCE CHARTS Also known as: Time motion diagrams, state diagrams, or bar chart. Used for: •Visualisi •Visualising ng the operatio operation n of switchin switching g systems. systems.
•Describing the step-by-step operation of relay systems, pneumatic systems, or any other type of switching systems.
Example: PLC control of actuators (solenoid valves) ACTUATOR - A
S2
Y1
ACTUATOR - B
S3
Y2 START
S1
S4
S5
Exam xample: (a) en energisi rgisin ng Y1, (b (b) de-en de-ene ergisi rgisin ng Y1 ACTUA TUATOR TOR - A
S2
Y1
S3
S2
Y1
(a) Cylind ylinder er ext extende ended d
(b) Cylind ylinder er retracted retracted
S3
Wiring diagram (Electro-pneumatic system) S1
+ -
00000
10000
S2
00001
10001
S3
00002
10002
00003
10003
S4 S5
Y1
Y2 00004
10004
00005
10005
. . .
COM
+ -
. . .
COM
+ +12VDC
TIMER A Timer consists of an internal clock, a count value register, and an accumulator. It is used for timing purposes. Input Clock
Reset Accumulator reset Register
Output
Contact output
Count
0
1 2 3 4
5
PLC TIMER ON –delay Timer: Example: If a timer in the circuit has a preset of 10 seconds, after a 10-second 10-second delay, delay, the timer ON-delay ON-delay energise energise contact contact closes and power is supplied to an output device via the contact.
Timing coil input
On-delay energise
Time delay
PLC TIMER OFF –delay Timer: Example: If a timer in the circuit has a preset of 10 seconds, after a 10-second 10-second delay, the timer timer OFF-delay de-energis de-energisee contact contact opens and power is removed from the controlled device.
Timing coil input
On-delay de-energise
Time delay
COUNTER Digital counters output in the form of a relay contact when a preassigned count value is reached. Input
input
Register
5
Reset Accumulator reset
Output Contact output
Count
0 1234
5
0
1
PLC COUNTER CNT (Counter (Counter)) is a preset decre decrementa mentall counter. counter. It decrements one count every time an input signal goes from OFF to ON. The counter must be programmed with a count input, a reset input, a counter number and a set value (SV). The set value can range from 0 to 9999.
Count input
CNT CNT 01 01 003
Reset input
Counter number SV
Example: A Traffic light control A
B
C
D
Traffic Light Control The sequence diagram for routes A,B,C and D. 120s 24s 4s ROUTE A Red Amber Green ROUTE B Red Amber Green ROUTE C Red Amber Green ROUTE D Red Amber Green
2s
24s
4s
2s
24s 4s
2s
24s
4s
2s
Solution: Consider routes A and B ONLY. 24s TIM0 tim0
TIM1 tim1
TIM2 tim2
TIM3 tim3
TIM4 tim4
TIM5 tim5
4s
2s
24s
4s
2s
Solution example: Consider routes A and B ONLY. 24s ROUTE A Red Amber Green
ROUTE B Red Amber Green
4s
2s
24s 4s
2s
[(tim5+tim0+tim1).tim2]+[tim4.tim5] tim3+tim4 tim2+tim3
(tim1+tim2+tim3+tim4).tim5 tim0+tim1 tim5+tim0
Solution example: Routes A and B ONLY TIM5
TIM3
TIM4
AMBER-A
TIM0 24S
TIM0
TIM2
GREEN-A
TIM1 4S
TIM1
TIM2 2S
TIM2
TIM1
TIM2
TIM4 4S
TIM4 TIM2
TIM0
TIM5 RED-B
TIM3 24S
TIM3
TIM5
TIM3
TIM3
TIM5 2S RED-A
TIM4
TIM0
TIM1
AMBER-B
TIM1 TIM5 TIM4
TIM0
GREEN-B
TIM5
END
EXAMPLE: CAR PARK CONTROL This is a simple car park control system that allow only a maximum of 100 parking spaces. spaces. Every time a car comes in, the LC will automatically add one through sensor S1. Any car that goes out will automatically be subtracted by one through sensor S2. When 100 cars are registered, the car park full sign will be lighted to inform oncoming vehicles not to enter. Car coming in
CAR PARK FULL S1 (00000)
(00200) S2 (00001) Car going out
Examples of DIFU and DIFD DIFU and DIFD turns an output ON for one scan time. DIFU turns its output ON when it detects an OFF-ON transition in its input signal. DIFD turns its output ON when it detects an ON-OFF transitions in its input signal. Timing diagram: INPUT DIFU DIFD
Examples of CMP Compare (CMP) is used to compare the data in a specific channel, with the data in another channel, or a four-digit, hexadecimal constant. Therefore, two data must be specified immediately after the CMP instruction. One of the data must be a channel. Ladder symbols: CMP source destination
Examples of ADD ADD (Addition) ADD totals the data in two different channels, or one channel and a constant and then outputs the sum s um to a third channel. Three data must be specified: an augend, an addend and a result channel. Ladder symbols: ADD Augend Addend Results
Examples of SUB SUB (Substract) SUB finds the difference between the data in one channel and the data in another channel or a constant, and then result to a third channel. Three data must be specified: an minuend, an substract substracthend hend and a rresult esult channel. channel. Ladder symbols: SUB Minuend Substracthend Results
00000
Example: Parking control 1.
Sense car coming in
2.
Add 1 for every car
3.
Sense car going out
4.
Subtract 1 for every car
5.
Compare with 100
6.
Indicator ON for CAR PARK FULL
DIFU 01000
01000
ADD HR00 #0001
00001
DIFU 01001
01001
SUB HR00 #0001
AR01
Note: Auxiliary relay -: contains flags and bits for special functions.
AR01 always turns ‘ON’). If constant equal 100, AR02 turns ON. AR03 turns ON if constant greater than 100.
AR01 AR02
CMP HR00 #0100 00200
AR03
Sequence Function Chart (GRAFCET) SFC is an approv approved ed means means of organisi organising ng the program program in a PLC. PLC. A program based on SFC has an inherently stable structure, has shorter scan time, and is easy to troubleshoot. troubleshoot .
Double box: Initial step 0 Between two steps is a transition (enables the next step to become active, and the preceeding step inactive).
1
Single box: Step
2
Sequence Function Chart (GRAFCET) Example:
When FORWARD PB switch is pressed and released, the conveyor will move. It will stop 1.5 sec after the infra red through sensor, S1, is blocked by the part on the belt. 0
Motor stopped
Forward pushbutton?
1
Motor runs forward
Sensor S1 is blocked?
2
Motor runs forward
Motor runs for 1.5 s?
Sequence Function Chart (GRAFCET)
To cater for more complex control requirements, two branching techniques are envisaged: selective and parallel •Selective branching: allows a choice of sequences. Example: There are 3 choices available. •Steps 34, 35, 36, 37 and back to 34 34
•Steps 34, 38, 39, 37 and back to 34 a
e
h
•Steps 34, 39, 37 and back to 34 35
38 b
36
f
•If 34 is is active active and ‘a’ is true, 35 35 is activated. activated.
39 c
Note: Cond Note: Conditi itions ons ‘a’ ‘a’,, ‘e’ ‘e’ and ‘h’ mus mustt be exclusive.
g
•If 34 is is active active and ‘e’ is true, 38 is activate activated d •If 34 is is active active and ‘h’ is true, 39 is activate activated d.
37 d
Sequence Function Chart (GRAFCET)
•Parallel branching : allows for two or more sequences to proceed simultaneously. Example: The main sequence diverges into three subsequences after step 53.
53
•Steps 54, 55
p
54
57 q
55
t 58
r 56
59
•Steps 57, 58 •Step 59 If 53 is active active and and ‘p’ is true, 54, 54, 57, and and 59 are are activated together. When 55, 55, 58, and and 59 are are active and and ‘r’ is true, 56 is activated.
s
Note: Two or more steps can be active at the same time. End End of of Lecture Lecture notes notes on on PLC PLC