PLC Basic
PLC Basic
PLC Basic
2.1 Instrumentation
2.2 Control
2.3 Programmable Logic Controllers
2.3.1 PLCs: Definition and Market
2.3.2 PLCs: Kinds
2.3.3 PLCs: Functions and construction
2.3.4 Continuous and Discrete Control
2.3.5 PLC Programming Languages
2.3.5.1 IEC 61131 Languages
2.3.5.2 Function blocks
2.3.5.3 Program Execution
2.3.5.4 Input / Output
2.3.5.5 Structured Text
2.3.5.6 Sequential Function Charts
2.3.5.7 Ladder Logic
2.3.5.8 Instruction Lists
2.3.5.9 Programming environment
Industrial Automation
2013
Formerly:
Today:
Function:
Distinguish
Instrumentation
flow meter, temperature, position,. but also actors (pump, )
Control
programmable logic controllers with digital peripherals & field bus
Visualization
Human Machine Interface (HMI) in PLCs (when it exists) is limited
to service help and control of operator displays
Industrial Automation
2013
Simple PLC
network
digital inputs
Industrial Automation
2013
PLC in a cabinet
CPU1
redundant field
bus connection
Industrial Automation
2013
CPU2
serial connections
inputs/outputs
Industrial Automation
2013
PLC: functions
Measure
Control (Command and Regulation)
Protection
Event Logging
Communication
Human interface
Industrial Automation
2013
PLC: Characteristics
large number of peripherals: 20..100 I/O per CPU, high density of wiring, easy assembly.
digital and analog Input/Output with standard levels
operate under harsh conditions, require robust construction, protection against dirt,
water and mechanical threats, electro-magnetic noise, vibration, extreme temperature
range (-30C..85C), sometimes directly located in the field.
programming: either very primitive with hand-help terminals on the target machine
itself, or with a laptop
network connection for programming on workstations and connection to SCADA
field bus connection for remote I/Os
primitive Human-Machine-Interface for maintenance, either through LCD-display or
connection of a laptop over serial lines (RS232) or wireless.
economical - 1000.- .. 15'000.- for a full crate.
the value is in the application software (licenses 20'000 ..50'000)
Industrial Automation
2013
Enterprise Network
Engineer
station
Operator
station
Supervisor
Station
gateway
direct I/O
Industrial Automation
2013
Field Stations
COM 2
CPU
I/O
gateway
COM
COM
CPU
I/O
I/O
COM
I/O
COM
CPU
I/O
I/O
I/O
I/O
CPU
PLC
Field Bus
FB
gateway
small PLC
data concentrators,
not programmable,
but configurable
COM1
I/O
I/O
Control Station
with Field Bus
Field Bus
COM
directly connected
I/O
I/O
I/O
PLC
COM 2
CPU
COM1
I/O
I/O
I/O
I/O
I/O
COM1
large
PLCs
CPU
Control Bus
(e.g. Ethernet)
Field Devices
Aftertheplantlost
electricpower,operators
couldreadinstrumentsonly
bypluggingintemporary
batteries
[IEEESpectrumNov2011
aboutFukushima]
Photo TEPCO
Industrial Automation
2013
Global players
2.1 Instrumentation
2.2 Control
2.3 Programmable Logic Controllers
2.3.1 PLCs: Definition and Market
2.3.2 PLCs: Kinds
2.3.3 PLCs: Functions and construction
2.3.4 Continuous and Discrete Control
2.3.5 PLC Programming Languages
2.3.5.1 IEC 61131 Languages
2.3.5.2 Function blocks
2.3.5.3 Program Execution
2.3.5.4 Input / Output
2.3.5.5 Structured Text
2.3.5.6 Sequential Function Charts
2.3.5.7 Ladder Logic
2.3.5.8 Instruction Lists
2.3.5.9 Programming environment
Industrial Automation
2013
Kinds of PLC
(1)
Compact
Monolithic construction
Monoprocessor
Fieldbus connection
(2)
Modular PLC
Modular construction (backplane)
One- or multiprocessor system
Fieldbus and LAN connection
Small Micro Memory Card (MMC) function possible
(3)
Soft-PLC
Windows NT or CE-based automation products
Direct use of CPU or co-processors
Industrial Automation
2013
Compact PLC
courtesy ABB
courtesy ABB
courtesy ABB
Thermocouple
inputs
binary I/Os,
CAN field bus
RS232 to HMI
courtesy Turbec
cost: 1000.-
Industrial Automation
2013
Modular PLC
tailored to the needs of an application
development
environment
RS232
LAN
backplane
parallel bus
courtesy ABB
fieldbus
Power Supply
primitive or no HMI
cost effective if the rack can be filled
CPU CPU
Analog I/O
Binary I/O
fieldbus
courtesy ABB
courtesy Backmann
Industrial Automation
2013
data bus
Compact or modular ?
field bus
extension
compact PLC
(fixed number of I/Os)
# I/O modules
Industrial Automation
2013
Industry- PC
courtesy INOVA
courtesy MPI
Wintel architecture
(but also: Motorola, PowerPC),
HMI (LCD..)
Limited modularity through mezzanine boards
(PC104, PC-Cards, IndustryPack)
Backplane-mounted versions with PCI or Compact-PCI
Industrial Automation
2013
23
4
3
3
12
2
PC as engineering workstation
PC as human interface (Visual Basic, Intellution, Wonderware)
PC as real-time processor
PC assisted by a Co-Processor (ISA- or PC104 board)
PC as field bus gateway to a distributed I/O system
I/O modules
Industrial Automation
2013
Protection devices
substation
measurement
transformers
communication to operator
Ir
Is
It
Ur
Us
UT
Human interface
for status
and
settings
Programming
interface
trip relay
Protection devices are highly specialized PLCs that measure the current and voltages in an electrical
substation, along with other statuses (position of the switches,) to detect situations that could
endanger the equipment (over-current, short circuit, overheat) and trigger the circuit breaker (trip) to
protect the substation.
In addition, they record disturbances and send the reports to the substations SCADA.
Sampling: 4.8 kHz, reaction time: < 5 ms.
costs: 5000
Industrial Automation
2013
Siemens
Hitachi
Number of Points
Memory
1024
10 KB
640
16 KB
Programming Language
Ladder logic
Instructions
Logic symbols
Hand-terminal
Ladder Logic
Instructions
Logic symbols
Basic
Hand-terminal
Programming Tools
Download
2678 cm2
1000 cm2
Label surface
per line/point
5.3 mm2
7 characters
6 mm2
6 characters
Network
10 Mbit/s
19.2 kbit/s
Mounting
DIN rail
cabinet
Industrial Automation
2013
2.1 Instrumentation
2.2 Control
2.3 Programmable Logic Controllers
2.3.1 PLCs: Definition and Market
2.3.2 PLCs: Kinds
2.3.3 PLCs: Functions and construction
2.3.4 Continuous and Discrete Control
2.3.5 PLC Programming Languages
2.3.5.1 IEC 61131 Languages
2.3.5.2 Function blocks
2.3.5.3 Program Execution
2.3.5.4 Structured Text
2.3.5.5 Sequential Function Charts
2.3.5.6 Ladder Logic
2.3.5.7 Instruction Lists
2.3.5.8 Programming environment
Industrial Automation
2013
Implementation
Industrial Automation
2013
CPU
Real-Time
Clock
ROM
flash
EPROM
serial port
controller
Ethernet
ethernet
controller
extension
bus
parallel bus
fieldbus
controller
buffers
analogdigital
converters
digitalanalog
converters
Digital Output
Digital
Input
signal
conditioning
power
amplifiers
relays
signal
conditioning
external
I/Os
field bus
Industrial Automation
2013
time
analog
variable
(e.g. 4..20mA)
time
filtering
&
scaling
sampling
analogdigital
converter
1
binary
variable
y(i)
filtering
011011001111
processing
sampling
(e.g. 0..24V)
0001111
counter
time
digitalanalog
converter
amplifier
analog
variable
e.g. -10V..10V
transistor
or
relay
binary
variable
non-volatile
memory
time
Industrial Automation
2013
Industrial Automation
2013
Industrial Automation
2013
2.1 Instrumentation
2.2 Control
2.3 Programmable Logic Controllers
2.3.1 PLCs: Definition and Market
2.3.2 PLCs: Kinds
2.3.3 PLCs: Functions and construction
2.3.4 Continuous and Discrete Control
2.3.5 PLC Programming Languages
2.3.5.1 IEC 61131 Languages
2.3.5.2 Function blocks
2.3.5.3 Program Execution
2.3.5.4 Input / Output
2.3.5.5 Structured Text
2.3.5.6 Sequential Function Charts
2.3.5.7 Ladder Logic
2.3.5.8 Instruction Lists
2.3.5.9 Programming environment
Industrial Automation
2013
discrete control
Industrial Automation
2013
analog regulation
PLC evolution
Binary World
Relay control, pneumatic
sequencer
Analog World
Pneumatic and electromechanical
controllers
I1
A
B
C
P1
P2
combinatorial
sequential
discrete processes
Regulation, controllers
continuous processes
(1+Ts)
F(s) =
(1+T1s + T2 s2)
time
init
Examples: Elevators,
traffic signaling,
warehouses, etc.
a
1
c+d
3
c + d
4
e
Discrete plants are described e.g. by finite state machines or Petri nets.
"combinatorial"1)
e.g. ladder logic, CMOS logic
A
Out = A B
A
NOT C
ladder
logic
B
Out = (A + B) C
I1
analog
building
blocs
P1
P2
2.1 Instrumentation
2.2 Control
2.3 Programmable Logic Controllers
2.3.1 PLCs: Definition and Market
2.3.2 PLCs: Kinds
2.3.3 PLCs: Functions and construction
2.3.4 Continuous and Discrete Control
2.3.5 Programming languages
2.3.5.1 IEC 61131 Languages
2.3.5.2 Function blocks
2.3.5.3 Program Execution
2.3.5.4 Input / Output
2.3.5.5 Structured Text
2.3.5.6 Sequential Function Charts
2.3.5.7 Ladder Logic
2.3.5.8 Instruction Lists
2.3.5.9 Programming environment
Industrial Automation
2013
Type 3 report
recommendation
IEC 61131-3
name change
70
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
"Real-Time" languages
ladder logic
Real-Time Java
instruction lists
Forth
GRAFCET
SDL
etc
could not impose themselves
Industrial Automation
2013
etc...
wide-spread in the control industry.
Now standardized as IEC 61131
PUMP
CALC
AUTO
>=1
IN1 OUT
DO
START STEP
T1
MAN_ON
STEP A
IN2
ACT
T2
STEP B
ACT
CALC
IN1 OUT
OUT
ACTION D1
D1_READY
ACTION D2
D2_READY
ACTION D3
D3_READY
ACTION D4
D4_READY
PUMP
IN2
MAN_ON
T3
CALC1
AUTO
http://www.isagraf.com
textual languages
More information:
http://www.plcopen.org/pages/tc1_standards/downloads/plcopen_iec61131-3_feb2014
.pptx
http://www.plcopen.org/pages/pc2_training/downloads/index.htm
Industrial Automation
2013
2.1 Instrumentation
2.2 Control
2.3 Programmable Logic Controllers
2.3.1 PLCs: Definition and Market
2.3.2 PLCs: Kinds
2.3.3 PLCs: Functions and construction
2.3.4 Continuous and Discrete Control
2.3.5 PLC Programming Languages
2.3.5.1 IEC 61131 Languages
2.3.5.2 Input & Output
2.3.5.3 Function blocks
2.3.5.4 Program Execution
2.3.5.5 Structured Text
2.3.5.6 Sequential Function Charts
2.3.5.7 Ladder Logic
2.3.5.8 Instruction Lists
2.3.5.9 Programming environment
Industrial Automation
2013
The Inputs and Outputs of the PLC must be connected to (typed) variables
IN_1
OUT_1
Industrial Automation
2013
predefined addresses
Industrial Automation
2013
2.1 Instrumentation
2.2 Control
2.3 Programmable Logic Controllers
2.3.1 PLCs: Definition and Market
2.3.2 PLCs: Kinds
2.3.3 PLCs: Functions and construction
2.3.4 Continuous and Discrete Control
2.3.5 PLC Programming Languages
2.3.5.1
IEC 61131 Languages
2.3.5.2
Input / Output
2.3.5.3
Function blocks language
2.3.5.4
Program Execution
2.3.5.5
Structured Text
2.3.5.6
Sequential Function Charts
2.3.5.7
Ladder Logic
2.3.5.8
Instruction Lists
2.3.5.9
Programming environment
Industrial Automation
2013
Industrial Automation
2013
&
external outputs
external inputs
Trigger
Running
Reset
Tempo
&
S Q
Spin
Industrial Automation
2013
input signals
Example
set point
measurement
parameters
PID
output signals
command
overflow
"continuously"
executing block,
independent,
no side effects
Example
Industrial Automation
2013
(set point)
(set point)
Industrial Automation
2013
Retroactions are an exception to this rule. In this case, the signal direction is
identified by an arrow (forbidden in some editors use global variables instead).
a
b
x
z
Industrial Automation
2013
1) Functions
- are part of the base library.
- have no memory.
Examples: and gate, adder, multiplier, selector,....
2) Elementary Function Blocks (EFB)
- are part of the base library
- have a memory ("static" data).
- may access global variables (side-effects !)
Examples: counter, filter, integrator,.....
3) Programs (Compound blocks)
- user-defined or application-specific blocks
- may have a memory
- may be configurable (control flow not visible in the FBD
Examples: PID controller, Overcurrent protection, Motor sequence
(a library of compound blocks may be found in IEC 61804-1)
Industrial Automation
2013
Industrial Automation
2013
Industrial Automation
2013
MoveAbsolute
AXIS_REF
BOOL
REAL
REAL
REAL
REAL
REAL
MC_Direction
Axis
Execute
Position
Velocity
Acceleration
Deceleration
Jerk
Direction
Axis
Done
CommandAborted
Error
ErrorID
AXIS_REF
BOOL
BOOL
BOOL
WORD
Industrial Automation
2013
or
XOR
S
R1
GT
and
OR
S1
R
analog elements
exclusive-or
SR
Q
RS
Q
R_TRIG
S
Q
flip-flop
dominant set
Q:=S1|(Q&!R)
flip-flop
dominant
reset
Q:=!R1&(Q|S)
positive
edge
TP/TON/TOF
IN
Q
PT
ET
bool
CTU
CU
RESET Q
CV
PV
bool
int
SEL
MUX
GE greater equal
GT greater than
LT less than
LE less equal
IN pos.edge: start
PT duration of delay
Q TP: 1, while PT
TON: 1, at PT
TOF: 0, at PT
ET actual delay
Up counter
(CTD counter down)
selector
(1:2)
multiplexer
(1:N)
ADD
adder
SUB
subtractor
MUL
multiplier
DIV
divider
INT
Reset
PV
In
integrator
2.
In
ADD
(e.g.10)
In1
INT
Reset = 0
PV
In
(e.g. 1024)
Out
In2
(initially 2)
DIV
(initially 2)
If (Reset) :
else:
3.
4.
t1
CTU
CU
RESET Q
CV
PV
t2
t3 t4 t5 t6
Out (initially 0)
Out := PV,
Out := t *In + Out
t7
t8
CU
Reset = 0, PV = 3, CV = #up Q = (CV >= PV) ?
Flipflop: dominant set or reset?
SR
S1
R
S
R1
RS
Q
dominant set
Q:=S1|(Q&!R)
dominant
reset
Q:=!R1&(Q|S)
http://tinyurl.com/IAFunctionBlock
https://docs.google.com/forms/d/1ynmoXf3JTcRn2yv2_4bKhcK0HJNDYpiTnQQm13lDSso/viewform
Industrial Automation
2013
ftp://advantechdownloads.com/Traini
ng/KW%20training/
b)
a)
c)
ftp://advantechdownloads.com/
Training/KW%20training/
https://docs.google.com/forms/d/1ynmoXf3JTcRn2yv2_4bKhcK0HJNDYpiTnQQm13lDSso/viewform
Industrial Automation
2013
2.
2, 12, 22, 32, 42
If out is initially 0:
0, 0, 0, 0, 0
If out is initially 1024: 1024, 1536, 2304,
3456, 5184
3.
CV = 1, 1, 2, 2, 3, 3, 4, 4
Q = 0, 0, 0, 0, 1, 1, 1, 1
4.
S1
R
SR
Q
dominant set
Q:=S1|(Q&!R)
Q
https://
docs.google.com/forms/d/1ynmoXf3JTcRn2yv2_4b
KhcK0HJNDYpiTnQQm13lDSso/viewform
Industrial Automation
2013
ftp://advantechdownloads.com/Traini
ng/KW%20training/
b)
Timer OFF delay
a)
Timer ON delay
c)
Pulse
ftp://advantechdownloads.com/
Training/KW%20training/
https://docs.google.com/forms/d/1ynmoXf3JTcRn2yv2_4bKhcK0HJNDYpiTnQQm13lDSso/viewform
Industrial Automation
2013
12s
75
0
-25
Industrial Automation
2013
75.0
-25.0
+ 8.3
-20.0
Industrial Automation
2013
y
T
Truth Table:
Mathematical Formula:
Textual Description:
Industrial Automation
2013
x1
x2
x1
x2
previous state
dx
Kpx Kd
Ki xd
dt
0
Calculates the root mean square of the input with a filtering constant
defined in parameter FilterDelay
Programmable Logic Controllers 2.3 - 61
Industrial Automation
2013
=
Compound block
=
Industrial Automation
2013
M1
Y1
Segment B
X2
Y2
M1
X3
Industrial Automation
2013
M2
2.1 Instrumentation
2.2 Control
2.3 Programmable Logic Controllers
2.3.1 PLCs: Definition and Market
2.3.2 PLCs: Kinds
2.3.3 PLCs: Functions and construction
2.3.4 Continuous and Discrete Control
2.3.5 PLC Programming Languages
2.3.5.1 IEC 61131 Languages
2.3.5.2 Function blocks
2.3.5.3 Program Execution
2.3.5.4 Input / Output
2.3.5.5 Structured Text
2.3.5.6 Sequential Function Charts
2.3.5.7 Ladder Logic
2.3.5.8 Instruction Lists
2.3.5.9 Programming environment
Industrial Automation
2013
A
B
C
F1
F3
Machine Code:
The function blocks are
translated to machine language
(intermediate code, IL),
that is either interpreted or
compiled to assembly language
Blocks are executed in sequence,
normally from upper left to lower right
The sequence is repeated every t ms.
Industrial Automation
2013
X01
F2
X02
function
input1
input2
output
F4
Y
F1
A
B
X01
F2
X01
X
F3
B
C
X02
F4
X
X02
Y
Programmable Logic Controllers 2.3 - 66
write
outputs
X
execute
individual period
O
time
Industrial Automation
2013
Program configuration
resource
task
task
program
program
FB
task
task
program
program
FB
FB
FB
represented variables
access paths
communication function
Legend:
FB
Industrial Automation
2013
Parallel execution
Function blocks are particularly well suited for true multiprocessing (parallel processors).
The performance limit is given by the needed exchange of signals by shared memory.
Semaphores are not used since they could block an execution and make the concerned
processes non-deterministic.
processor
1
processor
2
processor
3
input/
output
shared
memory
shared
memory
shared
memory
shared
memory
Industrial Automation
2013
2.1 Instrumentation
2.2 Control
2.3 Programmable Logic Controllers
2.3.1 PLCs: Definition and Market
2.3.2 PLCs: Kinds
2.3.3 PLCs: Functions and construction
2.3.4 Continuous and Discrete Control
2.3.5 PLC Programming Languages
2.3.5.1 IEC 61131 Languages
2.3.5.2 Function blocks
2.3.5.3 Program Execution
2.3.5.4 Input / Output
2.3.5.5 Structured Text
2.3.5.6 Sequential Function Charts
2.3.5.7 Ladder Logic
2.3.5.8 Programming environment
Industrial Automation
2013
Structured Text
(StrukturierteTextsprache,langagelittralstructur)
Industrial Automation
2013
Keyword
BOOL
SINT
INT
DINT
LINT
USINT
UINT
UDINT
ULINT
REAL
LREAL
TIME
DATE
TIME_OF_DAY or TOD
DATE_AND_TIME or DT
STRING
BYTE
WORD
DWORD
LWORD
Industrial Automation
2013
Data Type
Bits
Boolean
Short integer
Integer
Double integer
Long integer
Unsigned short integer
Unsigned integer
Unsigned double integer
Unsigned long integer
Real numbers
Long reals
Duration
Date (only)
Time of day (only)
Date and time of day
Character string
Bit string of length 8
Bit string of length 16
Bit string of length 32
Bit string of length 64
variable length double-byte string
1
8
16
32
64
8
16
32
64
32
64
variable
variable
variable
variable
variable
8
16
32
64
Data Types
Function Blocks are typed: the types of connection, input and output must match.
Elementary Types are defined either in Structured Text or in the FB configuration.
analog types:
binary types:
BOOL
BYTE
WORD
DWORD
1
8
16
32
REAL
LREAL
(Real32)
(Real64)
TYPE
ANALOG_CHANNEL_CONFIGURATION
STRUCT
RANGE: ANALOG_SIGNAL_RANGE;
MIN_SCALE : ANALOG_DATA ;
MAX_SCALE : ANALOG_DATA ;
END_STRUCT;
ANALOG_16_INPUT_CONFIGURATION :
STRUCT
SIGNAL_TYPE : ANALOG_SIGNAL_TYPE;
FILTER_CHARACTERISTIC : SINT (0.99)
CHANNEL: ARRAY [1..16] OF ANALOG_CHANNEL_CONFIGURATION;
END_STRUCT ;
END_TYPE
Industrial Automation
2013
2.1 Instrumentation
2.2 Control
2.3 Programmable Logic Controllers
2.3.1 PLCs: Definition and Market
2.3.2 PLCs: Kinds
2.3.3 PLCs: Functions and construction
2.3.4 Continuous and Discrete Control
2.3.5 PLC Programming Languages
2.3.5.1 IEC 61131 Languages
2.3.5.2 Function blocks
2.3.5.3 Program Execution
2.3.5.4 Input / Output
2.3.5.5 Structured Text
2.3.5.6 Sequential Function Charts
2.3.5.7 Ladder Logic
2.3.5.8 Programming environment
Industrial Automation
2013
START STEP
T1
STEP A
STEP B
ACTION D1
D1_READY
ACTION D2
D2_READY
T2
Industrial Automation
2013
SFC: Elements
S0
event condition
("1" = always true)
"1"
transitions
Sa
states
token
Ea
Sb
Eb
Sc
State which come into existence with a token are called initial states.
All initial states receive exactly one token, the other states receive none.
Industrial Automation
2013
"1"
token switch : the token crosses the first active
Sa
Ea
Eb
Sc
Ec
Sb
Sd
Ed
Se
Ee
Industrial Automation
2013
Ef
Sg
Sf
Eg
State1
P1 State1_P1: do at enter
N
State1_N: do while
P0 State1_P0: do at leaving
Industrial Automation
2013
rather than define a P0 action reset timer., there is an implicit variable defined as
<state name>.t that express the time spent in that state.
S
S.t > t#5s
Sf
Industrial Automation
2013
intentional displacement to
avoid optical preference of a
path.
Priority:
Industrial Automation
2013
SFC: Exercise
Variables
Input:
I0, I1, I2, I3;
Output:
Trap = {0: closed; 1: open}
Speed = {+20: +1 m/s; +1: +5 cm/s; 0: 0m/s}
Register = {0: closed; 1: open}
negative values: opposite direction
trap
I0
+speed
I1
I2
I3
initially: move vehicle at reduced speed until it touches I0 and open the trap for 5s
(empty the vehicle). Speed = 5 cm/s between I0 and I1 or between I2 and I3,
speed = 1 m/s between I1 and I2.
1 - Let the vehicle move from I0 to I3
2 - Stop the vehicle when it reaches I3.
3 - Open the tank during 5s.
Industrial Automation
2013
4 - Go back to I0
5 - Open the trap and wait 5s.
repeat above steps indefinitely
Programmable Logic Controllers 2.3 - 84
Right2Left
Industrial Automation
2013
SFC: Structuring
Every flow chart without a token generator may be redrawn as a
structured flow chart (by possibly duplicating program parts)
Not structured
structured
A
a
b
d
B'
A'
Industrial Automation
2013
Solution:
assistance through the flow chart editor.
Function Blocks:
Continuous (time) control
Principle:
A flow chart taken as a whole can be considered a function
block with binary inputs (transitions) and binary outputs (states).
Industrial Automation
2013
procedure
xy(...);
begin
...
endxy;
extern (ST)
function blocks
flow chart
Industrial Automation
2013
Function Block
a
"1"
S
R
c
NOT
b
d
Industrial Automation
2013
Flow Chart
init
"1"
a
b
Function Blocks
S
R
&
B
C
S
R
B
&
b
S
R
C
&
Industrial Automation
2013
2.1 Instrumentation
2.2 Control
2.3 Programmable Logic Controllers
2.3.1 PLCs: Definition and Market
2.3.2 PLCs: Kinds
2.3.3 PLCs: Functions and construction
2.3.4 Continuous and Discrete Control
2.3.5 PLC Programming Languages
2.3.5.1 IEC 61131 Languages
2.3.5.2 Function blocks
2.3.5.3 Program Execution
2.3.5.4 Input / Output
2.3.5.5 Structured Text
2.3.5.6 Sequential Function Charts
2.3.5.7 Ladder Logic
2.3.5.8 Programming environment
Industrial Automation
2013
Output (actions)
Rung 0
Rung 1
Rung 2
Industrial Automation
2013
origin:
electrical
circuit
make contact
(contact travail)
01
02
relay coil
(bobine)
03
50
break contact
(contact repos)
02
01
corresponding
ladder diagram
50
03
50
05
44
Industrial Automation
2013
rung
The contact plan or "ladder logic" language allows an easy transition from the
traditional relay logic diagrams to the programming of binary functions.
It is well suited to express combinational logic
It is not suited for process control programming (there are no analog elements).
The main ladder logic symbols represent the elements:
make contact
break contact
relay coil
Industrial Automation
2013
bobine
Spule
01
logic" equivalent
01
02
50
02
50
01
40
02
01
02
40
Industrial Automation
2013
textual expression
! 1 & 2 & ( 3 & ! 4 | ! 5 & 6 ) = 50
50
Or
N1 & 2 STR 3 & N4 STR N5 & 6
/ STR & STR = 50
0
2
1
3
10
4
6
11
Industrial Automation
2013
5
7
12
50
00
01
FUN 02
200
literal expression:
!00 & 01 FUN 02 = 200
Industrial Automation
2013
Which lamps are lit with the current switch positions? What happens if you change the position of
Switch SW-1?
Source: http://teacher.buet.ac.bd/zahurul/ME6401/ME6401_PLC.pdf
Industrial Automation
2013
Source: http://teacher.buet.ac.bd/zahurul/ME6401/ME6401_PLC.pdf
Industrial Automation
2013
Source: http://teacher.buet.ac.bd/zahurul/ME6401/ME6401_PLC.pdf
Industrial Automation
2013
Industrial Automation
2013
2.1 Instrumentation
2.2 Control
2.3 Programmable Logic Controllers
2.3.1 PLCs: Definition and Market
2.3.2 PLCs: Kinds
2.3.3 PLCs: Functions and construction
2.3.4 Continuous and Discrete Control
2.3.5 PLC Programming Languages
2.3.5.1 IEC 61131 Languages
2.3.5.2 Function blocks
2.3.5.3 Program Execution
2.3.5.4 Input / Output
2.3.5.5 Structured Text
2.3.5.6 Sequential Function Charts
2.3.5.7 Ladder Logic
2.3.5.8 Instructions Lists
2.3.5.9 Programming environment
Industrial Automation
2013
Industrial Automation
2013
Industrial Automation
2013
End:
ST
temp3
(* result *)
Instructions Lists is the most efficient way to write code, but only for specialists.
Otherwise, IL should not be used, because this language:
provides no code structuring
has weak semantics
is machine dependent
Industrial Automation
2013
LDN BOOL2
ST ERG
JMP continue
mark:
LD BOOL2
ST ERG
continue:
Brackets (without)
LD 2
MUL 2
ADD 3
ST ERG
(with)
LD 2
MUL(2
ADD 3
)
ST ERG (* 10 is stored in ERG*)
Ladder Diagram
A B
-| |--|/|----------------( )
Instruction List
?
Structured Text
C:= ?
http://tinyurl.com/IA61131
https://docs.google.com/forms/d/1lGkFXQrlwlnoKc8gUg-_ESAdtVy-RgIOLnFbkIOGNa8/viewform
Industrial Automation
2013
Ladder Diagram
A B
-| |--|/|----------------( )
AND
Instruction List
LD
ANDN
ST
Structured Text
http://tinyurl.com/IA61131
https://docs.google.com/forms/d/1lGkFXQrlwlnoKc8gUg-_ESAdtVy-RgIOLnFbkIOGNa8/viewform
Industrial Automation
2013
2.1 Instrumentation
2.2 Control
2.3 Programmable Logic Controllers
2.3.1 PLCs: Definition and Market
2.3.2 PLCs: Kinds
2.3.3 PLCs: Functions and construction
2.3.4 Continuous and Discrete Control
2.3.5 PLC Programming Languages
2.3.5.1 IEC 61131 Languages
2.3.5.2 Function blocks
2.3.5.3 Program Execution
2.3.5.4 Input / Output
2.3.5.5 Structured Text
2.3.5.6 Sequential Function Charts
2.3.5.7 Ladder Logic
2.3.5.8 Instructions Lists
2.3.5.9 Programming environment
Industrial Automation
2013
Industrial Automation
2013
symbols
laptop
code
firmware
download
variable
monitoring
and
forcing
for debugging
network
PLC
Industrial Automation
2013
Program maintenance
The source of the PLC program is generally on the laptop of the technician.
This copy is frequently modified, it is difficult to track the original in a process
database, especially if several persons work on the same machine.
Therefore, it would be convenient to be able to reconstruct the source programs
out of the PLC's memory (called back-tracking, Rckdokumentation, reconstitution).
This supposes that the instruction lists in the PLC can be mapped directly to graphic
representations -> set of rules how to display the information.
Names of variables, blocks and comments must be kept in clear text, otherwise the
code, although correct, would not be readable.
For cost reasons, this is seldom implemented.
Industrial Automation
2013
Industrial Automation
2013
Industrial Automation
2013
Assessment
Which are programming languages defined in IEC 61131 and for what are they used ?
In a function block language, which are the two elements of programming ?
How is a PLC program executed and why is it that way ?
Draw a ladder diagram and the corresponding function chart.
Draw a sequential chart implementing a 2-bit counter
Program a saw tooth waveform generator with function blocks
How are inputs and outputs to the process treated in a function chart language ?
Program a sequencer for a simple chewing-gum coin machine
Program a ramp generator for a ventilator speed control (soft start and stop in 5s)
Industrial Automation
2013
V1
L1
V3
V2
upper
lower
MS
H1
heater
(actor)
temperature
(sensor)
V4
MD
Industrial Automation
2013