Industrial Automation PLC Architecture Programmable Logic Controller PLC Prof. José A. Rodríguez Mondéjar UPCO ICAI Departamento de Electrónica y Automática 1 Industrial Automation PLC Architecture 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 Prof. José A. Rodríguez Mondéjar UPCO ICAI Departamento de Electrónica y Automática 2 1 Industrial Automation PLC Architecture More PLC characteristics (I) • Typical wired relay control Flexibility – Same PLC model in different machines – Implementing changes and correct errors • Change program • Versus rewiring connections Prof. José A. Rodríguez Mondéjar UPCO ICAI Departamento de Electrónica y Automática 3 Industrial Automation PLC Architecture 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) Prof. José A. Rodríguez Mondéjar UPCO ICAI Departamento de Electrónica y Automática 4 2 Industrial Automation PLC Architecture 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 I/O modules CPU Prof. José A. Rodríguez Mondéjar UPCO ICAI Departamento de Electrónica y Automática 5 Industrial Automation PLC Architecture Connection example (motor control) • Integrated CPU General Run Temper VCC E124.0 E124.1 VCC PLC A124.0 A124.1 E124.2 A124.2 GND GND Prof. José A. Rodríguez Mondéjar BTemper Motor relay UPCO ICAI Departamento de Electrónica y Automática 6 3 Industrial Automation PLC Architecture 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. Prof. José A. Rodríguez Mondéjar UPCO ICAI Departamento de Electrónica y Automática 7 Industrial Automation PLC Architecture 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 Prof. José A. Rodríguez Mondéjar Filter (50 Khz) Converter Terminal UPCO ICAI Departamento de Electrónica y Automática 8 4 Industrial Automation PLC Architecture 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 Prof. José A. Rodríguez Mondéjar Optoisolator Converter UPCO ICAI Departamento de Electrónica y Automática 9 Industrial Automation PLC Architecture Digital Output module Classification • • Relay Transistor Prof. José A. Rodríguez Mondéjar UPCO ICAI Departamento de Electrónica y Automática 10 5 Industrial Automation PLC Architecture 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 Prof. José A. Rodríguez Mondéjar UPCO ICAI Departamento de Electrónica y Automática 11 Industrial Automation PLC Architecture Internal Block Diagram of a PLC (I) NETWORK TIMERS Processor COUNTERS INPUT MODULES Prof. José A. Rodríguez Mondéjar CLOCK ROM RAM OUTPUT MODULES UPCO ICAI Departamento de Electrónica y Automática 12 6 Industrial Automation PLC Architecture 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 Prof. José A. Rodríguez Mondéjar UPCO ICAI Departamento de Electrónica y Automática 13 Industrial Automation PLC Architecture 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 Prof. José A. Rodríguez Mondéjar UPCO ICAI Departamento de Electrónica y Automática 14 7 Industrial Automation PLC Architecture How does PLC work? • Like a computer: – Operating System (Real Time Operating System RTOS) – Executes User Control Program main() { PLC int i1, i2, f; while (1) { VCC Input1 Input2 VCC Read Inputs; E124.0 A124.0 E124.1 A124.1 Execute user program; E124.2 GND Write Outputs; A124.2 GND } } Prof. José A. Rodríguez Mondéjar UPCO ICAI Departamento de Electrónica y Automática 15 Industrial Automation PLC Architecture PLC Example • Input1 Input2 Like a computer: – Keyboard is the input signals for plant – Screen is the output signals to the plant main() { PLC int i1, i2, f; while (1) { Input1 Input2 VCC i1=Read(Input1); VCC E124.0 i2=Read(Input2); A124.0 E124.1 A124.1 f=i1&&i2; %AND E124.2 GND Write(f,Output1) A124.2 GND } } Prof. José A. Rodríguez Mondéjar User Control Program UPCO ICAI Departamento de Electrónica y Automática 16 8 Industrial Automation PLC Architecture Example running Event Loss Scan time Input1 Input2 Output1 i1 i2 f CPU SO USER CONTROL PROGRAM Null Task Read Inputs Prof. José A. Rodríguez Mondéjar Write Outputs UPCO ICAI Departamento de Electrónica y Automática 17 Industrial Automation PLC Architecture SCAN CYCLE INPUT TERMINALS INPUT STATUS TABLE INPUT SCAN: Input terminals are read and inputs status table is updated accordingly Prof. José A. Rodríguez Mondéjar USER PROGRAM OUTPUT STATUS TABLE PROGRAM SCAN: During program scan, data in input table is applied to user program, program is executed and output table is updated accordingly OUTPUT TERMINALS OUTPUT SCAN: Data associated with output status table is transferred to output terminals UPCO ICAI Departamento de Electrónica y Automática 18 9 Industrial Automation PLC Architecture 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. Prof. José A. Rodríguez Mondéjar UPCO ICAI Departamento de Electrónica y Automática 19 Industrial Automation PLC Architecture Do you understand? • Output? – 0 permanent – 1 permanent – 0101010… main() { int i1, i2, f; PLC while (1) { i1=Read(Input1); VCC Input1 Input2 i2=Read(Input2); E124.0 VCC A124.0 E124.1 f=i1&&i2; %AND A124.1 E124.2 f=i1||i2; %OR A124.2 GND GND Write(f,Output1) } } Prof. José A. Rodríguez Mondéjar UPCO ICAI Departamento de Electrónica y Automática 20 10 Industrial Automation PLC Architecture HOW TO PROGRAM A PLC? • High level language? Control System – C Language – Difficult to program • Process • Pointers!! Language near technicians background PLC – Easy to program – Standard – Flexible Serial communication • Easy and complex languages in the same PLC Prof. José A. Rodríguez Mondéjar UPCO ICAI Departamento de Electrónica y Automática 21 Industrial Automation PLC Architecture IEC 1131-3 Standard • The IEC standard specifies the following programming languages Instruction List AND A ANDN B = C Sequential Function Chart (GRAFCET) 0 Structured Text Init C:= A AND NOT B 1 Stopped Run 2 Function Block Diagram 3 AND A Fill Prof. José A. Rodríguez Mondéjar Heat Hot C B Ladder Diagram Full 4 Empty out A B C -| |--|/|----------------( ) Empty UPCO ICAI Departamento de Electrónica y Automática 22 11 Industrial Automation PLC Architecture Memory model • 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 – 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 • • MD0 MW0 Industrial Automation 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) Input Table Output Table M255 E127 A127 ····· – M0.1, MB3, MW4, MD0 – User variables User Table ····· Memory ····· • MB0 M3.2 UPCO ICAI Departamento de Electrónica y Automática 23 Variable Types or Table Types • MB5 8x16 Memory PLC Architecture • MW8 8 bit – %MW0 Prof. José A. Rodríguez Mondéjar MD12 M1 M0 E1 E0 A1 A0 Timers Counters T127 Z63 Timer Table – T1 (16 bits timer – The value increases by clock Counter Table – Z5 (16 bits counter – Event count Prof. José A. Rodríguez Mondéjar ····· • Components of the PLC program: ····· • T1 T0 Z1 Z0 UPCO ICAI Departamento de Electrónica y Automática 24 12 Industrial Automation PLC Architecture Ladder Diagram Example E124.0 E124.1 E124.2 E124.2 Symbol Programming A124.0 General A124.1 Térmico Run Térmico Motor BTérmico Symbol definition increases program readable VCC General Run Térmico E124.0 E124.1 VCC PLC A124.0 A124.1 E124.2 A124.2 GND GND Prof. José A. Rodríguez Mondéjar BTérmico Motor UPCO ICAI Departamento de Electrónica y Automática 25 Industrial Automation PLC Architecture Ladder Diagram is only a representation • • The program execution is not parallel The execution is instruction by instruction: in sequence Segmento 1: Control A124.0 1 E124.0 3 A124.0 E124.1 – The brain of a PLC if a microprocessor 2 Segmento 2: Control A124.1 4 5 6 Prof. José A. Rodríguez Mondéjar E124.1 7 A124.1 E124.2 E124.3 UPCO ICAI Departamento de Electrónica y Automática 26 13 PLC Architecture Industrial Automation 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 Prof. José A. Rodríguez Mondéjar UPCO ICAI Departamento de Electrónica y Automática 27 14