Automation Industrielle
Automation Industrielle
Automation Industrielle
Automation Industrielle
Industrielle Automation
K_TIT
TIT_ERROR I P WFD_TIT
TIT_REF_TAB lim PID
N_GT
D
100 TD_TIT
FAULT_STATE[tit1_oor] 0 TIT_RATE_LIM_DN
OR
FAULT_STATE[tit2_oor]
TIT 17.3
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 Programmable Logic Controllers 2.3 - 2
PLC = Programmable Logic Controller: Definition
Formerly: cabled relay control (hence 'logic'), analog (pneumatic, hydraulic) “governors”
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 Programmable Logic Controllers 2.3 - 3
Simple PLC
digital outputs
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 4
PLC in a cabinet
CPU1 CPU2
serial connections
redundant field
bus connection
inputs/outputs
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 5
example: turbine control (in the test lab)
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 6
PLC: functions
• Measure
• Control (Command and Regulation)
• Protection
•Event Logging
•Communication
•Human interface
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 7
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 Programmable Logic Controllers 2.3 - 8
PLC: Location in the control architecture
Enterprise Network
Engineer Operator Supervisor
station station Station gateway
Control Bus
(e.g. Ethernet)
PLC
large
COM1
COM 2
Control Station
COM1
COM 2
COM1
CPU
PLC
CPU
CPU
I/O
with Field Bus gateway
PLCs
I/O
I/O
I/O
I/O
I/O
I/O
I/O
I/O
I/O
direct I/O
Field Bus Field Bus
COM
COM
COM
COM
CPU
CPU
CPU
COM
I/O
I/O
I/O
I/O
I/O
I/O
I/O
directly connected
I/O
Field Stations FB
gateway Field Devices
small PLC
data concentrators,
not programmable,
but configurable
Sensor Bus (e.g. ASI)
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 9
Why 24V / 48 V supply ?
Photo TEPCO
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 10
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 Programmable Logic Controllers 2.3 - 12
Kinds of PLC
(1) Compact
Monolithic construction
Monoprocessor
Fieldbus connection
(3) Soft-PLC
Windows NT or CE-based automation products
Direct use of CPU or co-processors
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 13
Compact PLC
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 14
Specific Controller (example: Turbine)
Thermocouple
inputs
binary I/Os,
CAN field bus
RS232 to HMI
courtesy Turbec
cost: € 1000.-
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 15
Modular PLC
• primitive or no HMI
CPU CPU Analog I/O Binary I/O
• cost effective if the rack can be filled fieldbus
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 16
Small modular PLC
courtesy ABB
courtesy Backmann
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 17
Specific controller (railways)
data bus
field bus
€ extension
# I/O modules
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 19
Industry- PC
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 20
Soft-PLC (PC as PLC)
• PC as engineering workstation
• PC as human interface (Visual Basic, Intellution, Wonderware)
23 12 • PC as real-time processor
4 2 2 • PC assisted by a Co-Processor (ISA- or PC104 board)
3
3 • PC as field bus gateway to a distributed I/O system
I/O modules
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 21
Protection devices
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 substation’s SCADA.
Sampling: 4.8 kHz, reaction time: < 5 ms.
costs: € 5000
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 22
Comparison Criteria – what matters
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 Programmable Logic Controllers 2.3 - 24
General PLC architecture
RS 232 Ethernet
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 25
The signal chain within a PLC
y y(i) y(i)
1
processing
binary transistor
binary
variable filtering sampling or
variable
(e.g. 0..24V)
0001111
relay
non-volatile
counter memory
y
time
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 26
Internals of a protection device
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 27
Signal flow in an IED
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 28
2.3.4 Continuous and discrete control
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 Programmable Logic Controllers 2.3 - 29
Matching the analog and binary world
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 30
PLC evolution
A
B
C
P1
P2
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 31
Continuous Plant (reminder)
(1+Ts)
x F(s) = y
(1+T1s + T2 s2) time
The time constant of the control system must be at least one order of
magnitude smaller than the smallest time constant of the plant.
the principal task of the control system for a continuous plant is its regulation.
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 32
Discrete Plant (reminder)
b
init c+d
2 3 4
a e
Examples: Elevators,
c + ¬d
traffic signaling, 1
e
warehouses, etc.
7 6 5
Discrete plants are described e.g. by finite state machines or Petri nets.
the main task of a control system with discrete plants is its sequential control.
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 33
Continuous and Discrete Control (comparison)
"combinatorial"1) "sequential"
Out = A · B
A
NOT C ladder
logic
B
Out = (A + B) · C
I1
analog
building
P1
blocs
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 Programmable Logic Controllers 2.3 - 35
"Real-Time" languages
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 36
The long march to IEC 61131
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
Function Block Diagram (FBD) graphical languages Sequential Flow Chart (SFC)
CALC1
START STEP
CALC PUMP
bFB(A:=1, B:=‘OK’);
Instruction List (IL) Z := X - INT_TO_REAL (bFB.OUT1);
A: LD %IX1 (* PUSH BUTTON *) IF Z>57.0 THEN aFB(A:=0, B:=“ERR”);
ANDN %MX5 (* NOT INHIBITED *) ELSE aFB(A:=1, B:=“Z is OK”);
ST %QX2 (* FAN ON *) END_IF
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 38
Importance of IEC 61131
80% of all PLCs support it, all new developments are based on it.
Depending on the country, some languages are more popular than others.
Exercise
http://docs.google.com/forms/d/1m4dQkDF89aGj5B
aL0Rzj9Xl7XprDvyU8pB4J0vd4sWo/viewform
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 39
2.4.2.1 Function Blocks Language
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 language
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 Programmable Logic Controllers 2.3 - 40
Function Block Languages
This language is similar to the Matlab / Simulink language used for simulations
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 41
Function Block Examples
Example 1:
A
B & C
Example 2:
external inputs external outputs
Trigger
Tempo &
S Q Spin
Running
Reset R
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 42
Function Block Elements
Example "continuously"
set point PID command executing block,
overflow independent,
measurement no side effects
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 43
Function Block Example
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 44
Function Block Rules
There exist exactly two rules for connecting function blocks by signals
(this is the actual programming):
• Each signal is connected to exactly one source.
This source can be the output of a function block or a plant signal.
• The type of the output pin, the type of the input pin and the signal type
must be identical.
The function plan should be drawn so the signals flow from left
to right and from top to bottom. Some editors impose additional rules.
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
c y
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 45
Types of Programming Organisation Units (POUs)
1) “Functions”
- are part of the base library.
- have no memory.
Examples: and gate, adder, multiplier, selector,....
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 46
Function Block library
The library describes the pinning of each block, its semantics and the
execution time.
The programmer may extend the library by defining function block macros
composed of library elements.
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 47
Library functions for discrete plants
Basic blocks
logical combinations (AND, OR, NOT, EXOR)
Flip-flop
Selector m-out-of-n
Multiplexer m-to-n
Timer
Counter
Memory
Sequencing
Compound blocks
Display
Manual input, touch-screen
Safety blocks (interlocking)
Alarm signaling
Logging
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 48
Analog function blocks for continuous control
Basic blocks
Summator / Subtractor
Multiplier / Divider
Integrator / Differentiator
Filter
Minimal value, Maximum value
Radix
Function generator
Regulation Functions
P, PI, PID, PDT2 controller
Fixed set-point
Ratio and multi-component regulation
Parameter variation / setting
2-point regulation
3-point regulation
Output value limitation
Ramp generator
Adaptive regulation
Drive Control
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 49
Function Block library for specialized applications
MoveAbsolute
Axis Axis
AXIS_REF AXIS_REF
BOOL Execute Done BOOL
REAL Position CommandAborted BOOL
REAL Velocity Error BOOL
REAL Acceleration ErrorID WORD
REAL Deceleration
REAL Jerk
MC_Direction Direction
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 50
IEC 61131-3 library (extract)
1. 2.
In1 INT
In ADD (e.g. 1024)
(e.g.10)
Out Reset Out
(initially 2) DIV PresetVal (initially 0)
In2 In
(initially 2)
(if reset) { Out := PV,
else Out:= Δt *In + Out}
3. t1 t2 t3 t4 t5 t6 t7 t8
CTU
CU
RESET Q CU
PV CV
Reset = 0, PV = 3 Q = (CV >= PV) ?
RS
S dominant reset
Q R1 Q Q:=!R1&(Q|S)
https://docs.google.com/forms/d/1ynmoXf3JTcRn2yv
2_4bKhcK0HJNDYpiTnQQm13lDSso/viewform ftp://advantechdownloads.com/Traini
ng/KW%20training/
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 52
Exercise: What do the following blocks do ?
1. 2.
3.
CV = 1, 1, 2, 2, 3, 3, 4, 4
Q = 0, 0, 0, 0, 1, 1, 1, 1
4.
S SR dominant set
S1 Q:=S1|(Q&!R)
R R Q
https://docs.google.com/forms/d/1ynmoXf3JTcRn2yv
2_4bKhcK0HJNDYpiTnQQm13lDSso/viewform ftp://advantechdownloads.com/Traini
ng/KW%20training/
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 53
Exercise: Which Behavior belongs to which Timer?
5.
TP/TON/TOF IN pos.edge: start
IN Q PT duration of delay
PT ET Q Timer Pulse: 1, while PT Timer ON delay: 1, at PT Timer OFF delay: 0, at PT
ET actual delay
b)
c)
a)
ftp://advantechdownloads.com/
Training/KW%20training/
https://docs.google.com/forms/d/1ynmoXf3JTcRn2yv2_4bKhcK0HJNDYpiTnQQm13lDSso/viewform
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 54
Exercise: Which Behavior belongs to which Timer?
5.
TP/TON/TOF IN pos.edge: start
IN Q PT duration of delay
PT ET Q Timer Pulse: 1, while PT Timer ON delay: 1, at PT Timer OFF delay: 0, at PT
ET actual delay
b)
Timer OFF delay
c)
a)
Pulse
Timer ON delay
ftp://advantechdownloads.com/
Training/KW%20training/
https://docs.google.com/forms/d/1ynmoXf3JTcRn2yv2_4bKhcK0HJNDYpiTnQQm13lDSso/viewform
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 55
Exercise: Asymmetric Sawtooth Wave
5s 12s
75
-25
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 56
Exercise: Saw-tooth FBD
75.0
-25.0
+ 8.3
-20.0
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 57
Specifying the behaviour of Function Block
Time Diagram:
0 T
x y x
y
T
Truth Table:
x1 x2 y
x1 S 0 0 previous state
x2 R 0 1 0
1 0 1
1 1 1
t
x dx y
Mathematical Formula:
Kpx Kd Ki xd
dt 0
Textual Description: Calculates the root mean square of the input with a filtering constant
defined in parameter „FilterDelay“
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 58
Function Block specification in Structured Text
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 59
Function Block decomposition
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 60
Function Block segmentation
X1
M2 M1
Y1
Segment B
X2 Y2
M1
X3 M2
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 61
2.3.5.3 Program execution
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 Programmable Logic Controllers 2.3 - 62
Execution of Function Blocks
function F1
Machine Code: input1 A
input2 B
The function blocks are output X01
translated to machine language F2
(intermediate code, IL), X01
that is either interpreted or X
F3
compiled to assembly language B
C
Blocks are executed in sequence, X02
normally from upper left to lower right F4
X
X02
The sequence is repeated every t ms. Y
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 63
Input-Output of Function Blocks
Run-time:
read write
inputs outputs
I X O I X O I X O
time
execute individual period
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 64
Program configuration
The programmer divides the program into tasks (sometimes called pages or
segments), which may be executed each with a different period.
Since the execution time of each block in a task is fixed, the execution time
is fixed.
If the execution time of these operations take more than one period,
they are executed in background.
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 65
IEC 61131 - Execution engine
configuration
resource resource
task task task task
FB FB FB FB
access paths
communication function
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 66
Parallel execution
Function blocks are particularly well suited for true multiprocessing (parallel
processors).
Semaphores are not used since they could block an execution and make the concerned
processes non-deterministic.
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 67
2.3.5.4 Input and Output
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 Programmable Logic Controllers 2.3 - 68
Connecting to Input/Output, Method 1: dedicated I/O blocks
The Inputs and Outputs of the PLC must be connected to (typed) variables
IN_1 OUT_1
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 69
Connecting to Input / Output, Method 2: Variables configuration
All program variables must be declared with name and type, initial value and volatility.
A variable may be connected to an input or an output, giving it an I/O address.
Several properties can be set: default value, fall-back value, store at power fail,…
These variables may not be connected as input, resp. output to a function block.
predefined addresses
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 70
2.3.5.5 Structured Text
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 Programmable Logic Controllers 2.3 - 71
Structured Text
Caution: writing programs in structured text can breach the real-time rules !
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 72
Data Types
Function Blocks are typed: the types of connection, input and output must match.
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 74
Example of Derived Types
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 Programmable Logic Controllers 2.3 - 75
2.3.5.6 Sequential Function Charts
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 Programmable Logic Controllers 2.3 - 76
SFC (Sequential Flow Chart)
START STEP
T1
N ACTION D1 D1_READY
STEP A STEP B
D ACTION D2 D2_READY
T2
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 77
SFC: Elements
S0
event condition
"1"
("1" = always true) transitions
Sa example transition condition
Eb
token
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 Programmable Logic Controllers 2.3 - 79
SFC: Switch and parallel execution
"1" E0
Sc
Ec
Sb Sd
Ed
token forking : when the transition Ee is true, the token Se
is replicated to all connected states Ee
Note: transition is before the fork
Ef Sg
token join : when all connected states have tokens Sf
and transition Eg is true, one single token is forwarded.
Note: transition is after the join
Eg
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 80
SFC: P1, N and P0 actions
The actions are described by a code block written e.g. in Structured Text.
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 81
Special action: the timer
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.
Sf
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 82
SFC: graphic rules
The input and output flow of a state are always in the same vertical line (simplifies structure)
Alternative paths are drawn such that no path is placed in the vertical flow
(otherwise would mean this is a preferential path)
intentional displacement to
avoid optical preference of a
path.
Priority:
• The alternative path most to the left has the
highest priority, priority decreases towards the right.
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 83
SFC: Exercise
Input: Variables
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
Register = {0: closed; 1: open}
+speed
trap
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.
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 84
Exercise: Wagon SFC
Right2Left
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 85
SFC: Building subprograms
T-element
::=
OR: OR:
S-element
::=
OR: OR: OR:
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 86
SFC: Structuring
A
a
A
B
a
b d
B d
C
b
c
C
c B' b
d
A' a
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 87
SFC: Complex structures
These general rules serve to build networks, termed by DIN and IEC as flow charts
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 88
Function Blocks And Flow Chart
Principle:
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 89
Executing Flow Charts As blocks
procedure
xy(...);
begin
...
end xy;
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 90
Flow Charts or Function Blocs ?
S
a
"1"
b R c
NOT d
c
d
a
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 91
Flow Charts Or Blocks ? (2)
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 92
2.3.5.7 Ladder Logic
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 Programmable Logic Controllers 2.3 - 93
Ladder logic (1)
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 94
Ladder Logic (2)
make contact
origin: (contact travail)
02
electrical 01 relay coil
circuit (bobine)
03 50
break contact
(contact repos)
01 02
corresponding 50 rung
03
ladder diagram
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 95
Ladder logic (3)
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 not suited for process control programming (there are no analog elements).
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 96
Ladder logic (4)
50 50
02
Parallel + 01
40 01
02 40
02
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 97
Ladder logic (5)
The ladder logic is more intuitive for complex binary expressions than literal languages
textual expression
1 2 3 4
50 !N 1 & 2 STR 3 & N 4 STR N 5
5 6 & 6 / STR & STR = 50
0 1 4 5 12
50 !0 & 1 STR 2 & 3 / STR STR 4
2 3 6 7 & 5 STR N 6 & 7
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 98
Ladder logic (6)
00 01
literal expression:
FUN 02 200
!00 & 01 FUN 02 = 200
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 99
Ladder logic (7)
IEC 61131 does not prescribe the minimum requirements for a compiler / interpreter
such as number of rungs per page nor does it specifies the minimum subset to be
implemented.
Therefore, it should not be used for large programs made by different persons
It is very limited when considering analog values (it has only counters)
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 100
2.3.6 Instruction Lists
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 Programmable Logic Controllers 2.3 - 101
Instruction Lists (1)
(Instruktionsliste, liste d'instructions)
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 102
Instruction Lists Example (2)
Instructions Lists is the most efficient way to write code, but only for specialists.
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 103
Exercise IEC 61131 Languages
A B C
?
-| |--|/|----------------( ) A ? C
?
B
? ?
? ? C:= ?
? ?
https://docs.google.com/forms/d/1lGkFXQrlwlnoKc8g
Ug-_ESAdtVy-RgIOLnFbkIOGNa8/viewform
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 104
Exercise IEC 61131 Languages
A B C
-| |--|/|----------------( ) A AND C
B
LD A
ANDN B C:= A AND NOT B
ST C
https://docs.google.com/forms/d/1lGkFXQrlwlnoKc8g
Ug-_ESAdtVy-RgIOLnFbkIOGNa8/viewform
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 105
2.3.5.9 Programming environment
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 Programmable Logic Controllers 2.3 - 106
Programming environment capabilities
- run simulations
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 107
61131 Programming environment
configuration, editor,
compiler, library
symbols laptop
code
variable
firmware monitoring
and
download forcing
for debugging
network
PLC
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 108
Program maintenance
The source of the PLC program is generally on the laptop of the technician.
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.
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 109
Is IEC 61131 FB an object-oriented language ?
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 110
Limitations of IEC 61131
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 111
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 Programmable Logic Controllers 2.3 - 112
Exercise: write the SFC for this task
V3 MS
H1 T temperature
(sensor)
heater
(actor)
V4
MD
Industrial Automation
2013 Programmable Logic Controllers 2.3 - 113