Programmable Logic Controller PLC UPCO ICAI Departamento de Electrónica y Automática 1 PLC Definition PLC is a user friendly, microprocessor based, specialized computer that carries out control functions of many types and levels of complexity DEFINE THE PLC ARCHITECTURE UPCO ICAI Departamento de Electrónica y Automática 2
More PLC characteristics (I) Flexibility Same PLC model in different machines Implementing changes and correct errors Change program Versus rewiring connections Typical wired relay control UPCO ICAI Departamento de Electrónica y Automática 3 More PLC characteristics (II) Lower cost Increased technology makes it possible to condense more functions into smaller and less expensive package. Pilot running A PLC based control can be prerun and evaluated in the office or lab. Reliability and Maintainability Solid-states devices are more reliable, in general, than mechanical systems or relays and timers. Consequently, the control system maintenance costs are low and downtime is minimal. Ladder or Boolean Programming Method The PLC programming can be accomplished in the ladder mode (similar to wired relay) by an electrician or technician (not complex automation) UPCO ICAI Departamento de Electrónica y Automática 4
Basic Module Architecture Central processing unit (CPU) The heart of the system: processes data, carries out the logic operations I/O Modules Input modules Takes input front the outside world (plant) Protects the CPU from the outside world (Optical Isolation) Output modules Power supply Provides output voltages to energize motor starters, lights, coils, valves CPU I/O modules UPCO ICAI Departamento de Electrónica y Automática 5 Connection example (motor control) Integrated CPU General Run Temper E124.0 E124.1 E124.2 PLC A124.0 A124.1 A124.2 BTemper Motor relay UPCO ICAI Departamento de Electrónica y Automática 6
Modular architecture The PLCs are expandable. Expansion modules contain additional inputs and outputs. These are connected to the base unit using a ribbon connector or a rack. UPCO ICAI Departamento de Electrónica y Automática 7 PLC Digital Input Module layout The input module perform four tasks electronically: Senses the presence or absence of an input signal at each of its input terminals. The input signal tells what switch, sensor or other signal is on or off in the process being controlled Standard levels: 24VDC, 110AC, 220AC, 4-20mA Converts the signal for on, or high to a DC level usable Carries out electronic isolation Produces an output to be sensed by the PLC CPU Optoisolator Filter (50 Khz) Converter Terminal UPCO ICAI Departamento de Electrónica y Automática 8
PLC Digital Output Module Layout A DC signal from the CPU is converted through each module section (terminal) to a usable output voltage, either AC or DC (voltage or current) Standard levels: 24VDC, 110AC, 220AC, 4-20mA Logic Input Optoisolator Converter UPCO ICAI Departamento de Electrónica y Automática 9 Digital Output module Classification Relay Transistor UPCO ICAI Departamento de Electrónica y Automática 10
Other modules Analog Input/Output modules ± 10 volts 0...10 volts 0...20 ma 4...20 ma Important point: speed acquisition / precision PID module Network module ASCII module UPCO ICAI Departamento de Electrónica y Automática 11 Internal Block Diagram of a PLC (I) NETWORK TIMERS COUNTERS Processor ROM RAM INPUT MODULES CLOCK OUTPUT MODULES UPCO ICAI Departamento de Electrónica y Automática 12
Internal Block Diagram of a PLC (II) Processor The computer center that carries out the logic operations (also arithmetic) Memory The area of the CPU in which information is stored and manipulated ROM (Read Only Memory) Operating System System Data RAM (Random Access Memory) User data Copy of input signal states Copy of output signal states Counters Timers User program UPCO ICAI Departamento de Electrónica y Automática 13 Internal Block Diagram of a PLC (III) Clock Clock speed determines how quickly microprocessor executes instructions. Communications RS232 Programming equipment: Personal computer Short distance RS485 or similar Connection with other equipment Long distance/noise immunity PROFIBUS FIPBUS MODBUS MPI UPCO ICAI Departamento de Electrónica y Automática 14
How does PLC work? Like a computer: Operating System (Real Time Operating System RTOS) Executes User Control Program main() { int i1, i2, f; PLC while (1) { Read Inputs; Input1 Input2 E124.0 E124.1 E124.2 Execute user program; A124.0 A124.1 A124.2 Write Outputs; } } UPCO ICAI Departamento de Electrónica y Automática 15 PLC Example Like a computer: Keyboard is the input signals for plant Screen is the output signals to the plant Input1 Input2 main() { int i1, i2, f; PLC while (1) { i1=read(input1); Input1 Input2 E124.0 E124.1 E124.2 i2=read(input2); f=i1&&i2; %AND A124.0 A124.1 A124.2 Write(f,Output1) } } User Control Program UPCO ICAI Departamento de Electrónica y Automática 16
Example running Input1 Input2 Output1 Scan time Event Loss i1 i2 f CPU SO USER CONTROL PROGRAM Read Inputs Write Outputs Null Task UPCO ICAI Departamento de Electrónica y Automática 17 SCAN CYCLE INPUT TERMINALS INPUT STATUS TABLE USER PROGRAM OUTPUT STATUS TABLE OUTPUT TERMINALS INPUT SCAN: Input terminals are read and inputs status table is updated accordingly PROGRAM SCAN: During program scan, data in input table is applied to user program, program is executed and output table is updated accordingly OUTPUT SCAN: Data associated with output status table is transferred to output terminals UPCO ICAI Departamento de Electrónica y Automática 18
IMPORTANT ANY changes in the status of input devices during the program or output scan are not recognized until the next input scan Data changes in the output table are not transferred to the output terminal during the input and program scans. The transfer affecting the output devices takes place only during the output scan. UPCO ICAI Departamento de Electrónica y Automática 19 Do you understand? Output? 0 permanent 1 permanent 0101010 Input1 Input2 E124.0 E124.1 E124.2 main() { int i1, i2, f; while (1) { i1=read(input1); i2=read(input2); f=i1&&i2; %AND f=i1 i2; %OR PLC A124.0 A124.1 A124.2 } } Write(f,Output1) UPCO ICAI Departamento de Electrónica y Automática 20
HOW TO PROGRAM A PLC? High level language? C Language Difficult to program Pointers!! Language near technicians background Easy to program Standard Flexible Easy and complex languages in the same PLC Control System PLC Process Serial communication UPCO ICAI Departamento de Electrónica y Automática 21 IEC 1131-3 Standard The IEC standard specifies the following programming languages Instruction List AND A ANDN B = C Sequential Function Chart (GRAFCET) 0 Init 1 Stopped Run Structured Text C:= A AND NOT B Function Block Diagram 2 Fill Full Ladder Diagram A B AND C 3 Heat Hot 4 Empty out Empty A B C - -- / ----------------( ) UPCO ICAI Departamento de Electrónica y Automática 22
Memory model Components of the PLC program: Instructions Data: Memory Matrix 8 bits x Address number 16 bits x Address number Accessing methods Bit M0.3 Work with logical variables Byte: MB0 Word: MW0, MW2. Long word: MD0, MD4 Telemecanique uses %MW0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 8 bit 8x16 Memory MD12 MW8 MB5 MB0 M3.2 MD0 MW0 UPCO ICAI Departamento de Electrónica y Automática 23 Variable Types or Table Types Memory M0.1, MB3, MW4, MD0 User variables Digital Input Table E124.0, EB124, EW124 (Siemens) I124.0, IB124, IW124 (IEC) Remember the difference between real input and input variable in the program. Digital Ouput Table A124.0, AB124, AW124 (Siemens) Q124.0, QB124, QW124 (IEC) Timer Table T1 (16 bits timer The value increases by clock Counter Table Z5 (16 bits counter Event count User Table M255 Input Table E127 Output Table A127 M1 E1 A1 M0 E0 A0 Timers T127 T1 T0 Counters Z63 Z1 Z0 UPCO ICAI Departamento de Electrónica y Automática 24
Ladder Diagram Example E124.0 E124.1 E124.2 A124.0 Symbol Programming General Run Térmico Motor E124.2 A124.1 Térmico BTérmico Symbol definition increases program readable General Run Térmico E124.0 E124.1 E124.2 PLC A124.0 A124.1 A124.2 BTérmico Motor UPCO ICAI Departamento de Electrónica y Automática 25 Ladder Diagram is only a representation The program execution is not parallel The execution is instruction 1 by instruction: in sequence The brain of a PLC if a microprocessor E124.1 Segmento 1: Control A124.0 E124.0 A124.0 2 3 Segmento 2: Control A124.1 4 E124.1 7 A124.1 5 E124.2 6 E124.3 UPCO ICAI Departamento de Electrónica y Automática 26
Choose a PLC Memory size Scan Time/Maximum number of instructions Integrated functions (PID) I/O Capability Different interfaces with real world Flexibility/expandability Maximum number of IO Signals that PLC can control Networking Non standard protocol Vs standard protocol Cost Serviceability/support Training/Documentation UPCO ICAI Departamento de Electrónica y Automática 27