UPCO ICAI Departamento de Electrónica y Automática 1 Prof. José A. Rodríguez Mondéjar
Programmable Logic Controller
PLC
Industrial Automation
PLC ArchitecturePLC Definition
•
PLC is a
•
user friendly,
•
microprocessor
based,
•
specialized computer
•
that carries out
control functions
•
of many types
•
and levels of
UPCO ICAI Departamento de Electrónica y Automática 3 Prof. José A. Rodríguez Mondéjar
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
Industrial Automation
UPCO ICAI Departamento de Electrónica y Automática 4 Prof. José A. Rodríguez Mondéjar
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)
UPCO ICAI Departamento de Electrónica y Automática 5 Prof. José A. Rodríguez Mondéjar
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
• Provides output voltages to energize motor starters, lights, coils, valves
CPU
I/O modules
Power supply
Industrial Automation
PLC ArchitectureConnection example (motor control)
•
Integrated CPU
VCC E124.0 E124.1 E124.2 GND VCC A124.0 A124.1 A124.2 GND General RunTemper BTemper Motor relay
UPCO ICAI Departamento de Electrónica y Automática 7 Prof. José A. Rodríguez Mondéjar
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.
Industrial Automation
UPCO ICAI Departamento de Electrónica y Automática 8 Prof. José A. Rodríguez Mondéjar
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
Converter
Terminal
Optoisolator
Filter (50 Khz)
UPCO ICAI Departamento de Electrónica y Automática 9 Prof. José A. Rodríguez Mondéjar
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
Industrial Automation
PLC ArchitectureDigital Output module Classification
•
Relay
UPCO ICAI Departamento de Electrónica y Automática 11 Prof. José A. Rodríguez Mondéjar
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
Industrial Automation
UPCO ICAI Departamento de Electrónica y Automática 12 Prof. José A. Rodríguez Mondéjar
PLC Architecture
Internal Block Diagram of a PLC (I)
OUTPUT MODULES INPUT
MODULES
Processor
ROM
RAM
NETWORK TIMERS
COUNTERS
UPCO ICAI Departamento de Electrónica y Automática 13 Prof. José A. Rodríguez Mondéjar
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
Industrial Automation
PLC ArchitectureInternal 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 15 Prof. José A. Rodríguez Mondéjar
How does PLC work?
•
Like a computer:
– Operating System (Real Time Operating System RTOS)
– Executes User Control Program
VCC E124.0 E124.1 E124.2 GND VCC A124.0 A124.1 A124.2 GND Input1 Input2
PLC
main() {int i1, i2, f;
while (1) {
Read Inputs;
Execute user program; Write Outputs;
}
}
Industrial Automation
UPCO ICAI Departamento de Electrónica y Automática 16 Prof. José A. Rodríguez Mondéjar
PLC Architecture
PLC Example
•
Like a computer:
– Keyboard is the input signals for plant
– Screen is the output signals to the plant
VCC E124.0 E124.1 E124.2 GND VCC A124.0 A124.1 A124.2 GND Input1 Input2
PLC
main() {int i1, i2, f;
while (1) {
i1=Read(Input1); i2=Read(Input2); f=i1&&i2; %AND Write(f,Output1)}
}
User Control Program
UPCO ICAI Departamento de Electrónica y Automática 17 Prof. José A. Rodríguez Mondéjar
Example running
Input1
Output1
i1
i2
f
Input2
Read Inputs
Write Outputs
SO
USER
CONTROL
PROGRAM
Null Task
CPU
Event Loss
Scan time
Industrial Automation
PLC ArchitectureSCAN 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
OUTPUT SCAN:
Data associated
with output
status table is
transferred to
output terminals
UPCO ICAI Departamento de Electrónica y Automática 19 Prof. José A. Rodríguez Mondéjar
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.
Industrial Automation
UPCO ICAI Departamento de Electrónica y Automática 20 Prof. José A. Rodríguez Mondéjar
PLC Architecture
Do you understand?
•
Output?
– 0 permanent
– 1 permanent
– 0101010…
VCC E124.0 E124.1 E124.2 GND VCC A124.0 A124.1 A124.2 GND Input1 Input2PLC
main() {int i1, i2, f;
while (1) {
i1=Read(Input1); i2=Read(Input2); f=i1&&i2; %AND f=i1||i2; %OR Write(f,Output1)}
}UPCO ICAI Departamento de Electrónica y Automática 21 Prof. José A. Rodríguez Mondéjar
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
PLC
Process
Serial
communication
Control System
Industrial Automation
PLC ArchitectureIEC 1131-3 Standard
•
The IEC standard specifies the following programming
languages
Instruction List
C:= A AND NOT B
A B C
-| |--|/|---( )
AND
A
ANDN
B
=
C
AND
A C
B
Structured Text
Ladder Diagram
Function Block Diagram
Sequential Function Chart
(GRAFCET)
0 Init 2 Fill 3 Heat Empty out Run Full Hot 1 Stopped Empty 4UPCO ICAI Departamento de Electrónica y Automática 23 Prof. José A. Rodríguez Mondéjar
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
8 bit
0 1 2 3 4 5 6 7 8 9 10 11 12 13 MB0 MW0 MD0 MW8 14 15 MD12 MB58x16 Memory
7 6 5 4 3 2 1 0M3.2
Industrial Automation
UPCO ICAI Departamento de Electrónica y Automática 24 Prof. José A. Rodríguez Mondéjar
PLC Architecture
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
M0
M255
User
Table
···
··
E0
E127
Input
Table
···
··
A0
A127
Output
Table
···
··
T0
T127
Timers
···
··
Z0
Z63
Counters
···
··
M1
E1
A1
T1
Z1
UPCO ICAI Departamento de Electrónica y Automática 25 Prof. José A. Rodríguez Mondéjar
Ladder Diagram Example
General Run Térmico Motor
Térmico BTérmico VCC E124.0 E124.1 E124.2 GND VCC A124.0 A124.1 A124.2 GND General Run
Térmico BTérmico Motor
PLC
Symbol Programming
E124.0 E124.1 E124.2 A124.0 E124.2 A124.1
Symbol definition
increases program
readable
Industrial Automation
PLC ArchitectureLadder Diagram is only a representation
•
The program execution is not
parallel
•
The execution is instruction
by instruction: in sequence
– The brain of a PLC if a
microprocessor
E124.0 A124.0
E124.1
Segmento 1: Control A124.0
E124.1
E124.2
E124.3
A124.1 Segmento 2: Control A124.1
1
2 34
5
6
7
UPCO ICAI Departamento de Electrónica y Automática 27 Prof. José A. Rodríguez Mondéjar