Ai 230 PLC
Ai 230 PLC
Ai 230 PLC
MAX_INT
N_GT TIT_REF_TAB lim TIT_ERROR I P PID D WFD_TIT
100 0
TD_TIT TIT_RATE_LIM_DN
17.3
2.3
Industrial Automation
PLC = Programmable Logic Controller: Definition AP = Automates Programmables industriels SPS = Speicherprogrammierbare Steuerungen Definition: small computers, dedicated to automation tasks in an industrial environment" cabled relay control (hence 'logic'), analog (pneumatic, hydraulic) governors real-time (embedded) computer with extensive input/output Measure, Control, Protect Instrumentation flow meter, temperature, position,. but also actors (pump, ) Control programmable logic controllers with digital peripherals & field bus Visualization HMI* in PLCs (when it exists) is limited to service help and control of operator displays
Programmable Logic Controllers 2.3 - 3
Formerly:
Today: Function: Distinguish
Industrial Automation
Simple PLC
network binary inputs
Industrial Automation
PLC in a cabinet
CPU1
CPU2
inputs/outputs
Industrial Automation
Industrial Automation
PLC: functions
(Messen, Schtzen, Regeln = MSR)
PLC = PMC: Protection, Measurement and Control
Industrial Automation
PLC: Characteristics
large number of peripherals: 20..100 I/O per CPU, high density of wiring, easy assembly. binary 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 lap-top able to down-load programs. network connection allows 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
Enterprise Network
Engineer station
Control Bus (e.g. Ethernet)
Operator station
Supervisor Station
gateway
COM 2
large PLCs
COM1
COM1
COM1
CPU
CPU
I/O
I/O
I/O
I/O
I/O
I/O
I/O
direct I/O
I/O
Field Bus
COM COM I/O COM COM
I/O
PLC
CPU I/O
COM 2
PLC
gateway Field Bus
Field Stations
small PLC
data concentrators, not programmable, but configurable Sensor Bus (e.g. ASI)
FB gateway
COM
CPU
CPU
CPU
I/O
I/O
I/O
I/O
I/O
I/O
Field Devices
Industrial Automation
After the plant lost electric power, operators could read instruments only by plugging in temporary batteries [IEEE Spectrum Nov 2011 about Fukushima]
Photo TEPCO
Industrial Automation
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
(2)
Modular PLC Modular construction (backplane) One- or multiprocessor system Fieldbus and LAN connection
3U or 6U rack, sometimes DIN-rail Large variety of input/output boards Connection to serial bus Small MMC function possible
(3)
Global players
Modular PLC tailored to the needs of an application housed in a 19" (42 cm) rack (height 6U ( = 233 mm) or 3U (=100mm) high processing power (several CPU) large choice of I/O boards concentration of a large number of I/O interface boards to field busses requires marshalling of signals primitive or no HMI cost effective if the rack can be filled
CPU CPU Analog I/O Binary I/O fieldbus
courtesy ABB
RS232
development environment
supply 115-230V~ , 24V= or 48V= (redundant) cost ~ 10000 for a filled crate
Industrial Automation
mounted on DIN-rail, 24V supply cheaper (5000) not water-proof, no ventilator extensible by a parallel bus (flat cable or rail)
Industrial Automation
data bus
three PLCs networked by a data bus. special construction: no fans, large temperature range, vibrations
Industrial Automation Programmable Logic Controllers 2.3 - 16
Compact or modular ?
# I/O modules
Industrial Automation Programmable Logic Controllers 2.3 - 17
Industry- PC
courtesy INOVA
courtesy MPI
Wintel architecture (but also: Motorola, PowerPC), MMI offered (LCD..) Limited modularity through mezzanine boards (PC104, PC-Cards, IndustryPack) Backplane-mounted versions with PCI or Compact-PCI
Industrial Automation
Competes with modular PLC no local I/O, fieldbus connection instead, costs: 2000.-
Soft-PLC (PC as PLC) PC as engineering workstation PC as human interface (Visual Basic, Intellution, Wonderware) PC as real-time processor (Soft-PLC) PC assisted by a Co-Processor (ISA- or PC104 board) PC as field bus gateway to a distributed I/O system
23 4 3 3
12 2
I/O modules
Industrial Automation
Compact PLC
courtesy ABB
courtesy ABB
courtesy ABB
Monolithic (one-piece) construction Fixed casing Fixed number of I/O (most of them binary) No process computer capabilities (no MMC) Can be extended and networked by an extension (field) bus Sometimes LAN connection (Ethernet, Arcnet) Monoprocessor Typical product: Mitsubishi MELSEC F, ABB AC31, SIMATIC S7 costs: 2000
Industrial Automation
Specific Controller (example: Turbine) tailored for a specific application, produced in large series
Programming port Thermocouple Relays and fuses
inputs
courtesy Turbec
cost: 1000.-
Industrial Automation
Protection devices
substation measurement transformers Ir Is It communication to operator
Ur Us UT
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 triggers the circuit breaker (trip) to protect the substation. In addition, it records disturbances and sends the reports to the substations SCADA. Sampling: 4.8 kHz, reaction time: < 5 ms.
costs: 5000
Industrial Automation Programmable Logic Controllers 2.3 - 22
1024 10 KB
Ladder logic Instructions Logic symbols Hand-terminal Graphic on PC no 2678 cm2
6 mm2 6 characters
19.2 kbit/s cabinet
Programmable Logic Controllers 2.3 - 23
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
CPU
Real-Time Clock
ROM
flash EPROM
ethernet controller
extension bus
parallel bus
buffers
fieldbus controller
Digital Output
Digital Input
signal conditioning
external I/Os
relays
field bus
Industrial Automation
time
time
time
analog variable
(e.g. 4..20mA)
sampling
analogdigital converter
1
011011001111
digitalanalog converter
amplifier
analog variable
e.g. -10V..10V
binary variable
(e.g. 0..24V)
filtering
sampling
0001111
counter
non-volatile memory
time
Industrial Automation
Input Anti aliasing Sample and hold transformer filter A/D conversion
U/I
A/D
Trip
CPU
reaction < 10 ms
f = 300 -1200 Hz
f = 200 kHz f = 100 kHz f = 1 MHz
Industrial Automation
Industrial Automation
discrete control
analog regulation
Industrial Automation
PLC evolution Binary World relay controls, Relay control pneumatic sequencer
A B C
P1 P2
combinatorial
sequential
Regulation, controllers
discrete processes
continuous processes
Continuous Plant (reminder) Example: traction motors, ovens, pressure vessel,... The state of continuous plants is described by continuous (analog) state variables like temperature, voltage, speed, etc. There exist a fixed relationship between input and output,described by a continuous model in form of a transfer function F. This transfer function can be expressed by a set of differential equations. If equations are linear, the transfer function may expressed as Laplace or Z-transform.
y x (1+Ts) F(s) = (1+T1s + T2 s2) y time
Continuous plants are normally reversible and monotone. This is the condition to allow their regulation. 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 Programmable Logic Controllers 2.3 - 31
The plant is described by variables which take well-defined, non-overlapping values. The transition from one state to another is abrupt, it is caused by an external event. Discrete plants are normally reversible, but not monotone, i.e. negating the event which caused a transition will not revert the plant to the previous state.
Example: an elevator doesn't return to the previous floor when the button is released.
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 Programmable Logic Controllers 2.3 - 32
Continuous and Discrete Control (comparison) "combinatorial"1) e.g. ladder logic, CMOS logic
A Out = A B A B Out = (A + B) C NOT C B
ladder logic
I1
P1 P2
Industrial Automation
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
"Real-Time" languages
Extend procedural languages to express time (introduce programming constructs to influence scheduling and control flow) ADA Real-Time Java MARS (TU Wien) Forth C with real-time features etc could not impose themselves
ladder logic function block language instruction lists GRAFCET SDL etc... wide-spread in the control industry. Now standardized as IEC 61131
Industrial Automation
NEMA Programmable Controllers Committee formed (USA) GRAFCET (France) DIN 40719, Function Charts (Germany) NEMA ICS-3-304, Programmable Controllers (USA) IEC SC65A/WG6 formed DIN 19 239, Programmable Controller (Germany) IEC 65A(Sec)38, Programmable Controllers MIL-STD-1815 Ada (USA) IEC SC65A(Sec)49, PC Languages IEC SC65A(Sec)67 IEC 848, Function Charts IEC 64A(Sec)90 IEC 1131-3 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
Source: Dr. J. Christensen it took 20 years to make that standard Industrial Automation Programmable Logic Controllers 2.3 - 36
http://www.isagraf.com
graphical languages
CALC
IN1 OUT
textual languages
IN2
MAN_ON
VAR CONSTANT X : REAL := 53.8 ; Z : REAL; END_VAR VAR aFB, bFB : FB_type; END_VAR bFB(A:=1, B:=OK); Z := X - INT_TO_REAL (bFB.OUT1); IF Z>57.0 THEN aFB(A:=0, B:=ERR); ELSE aFB(A:=1, B:=Z is OK); END_IF
Industrial Automation
IEC 61131-3 is the most important automation language in industry. 80% of all PLCs support it, all new developments base on it. Depending on the country, some languages are more popular.
Industrial Automation
Industrial Automation
Function Block Languages (Funktionsblocksprache, langage de blocs de fonctions) (Also called "Function Chart" or "Function Plan" - FuPla)
The function block languages express "combinatorial" programs in a way similar to electronic circuits. They draw on a large variety of predefined and custom functions This language is similar to the Matlab / Simulink language used in simulations
Industrial Automation
&
Tempo
&
S Q R
Spin
Function blocks is a graphical programming language, which is akin to the electrical and block diagrams of the analog and digital technique. It mostly expresses combinatorial logic, but its blocks may have a memory (e.g. RS-flip-flops but no D-flip-flops: no edge-triggered logic).
Industrial Automation Programmable Logic Controllers 2.3 - 41
Function Block Elements Function block Example input signals parameters output signals PID "continuously" executing block, independent, no side effects
set point
measurement
command overflow
The block is defined by its: Data flow interface (number and type of input/output signals) Black-Box-Behavior (functional semantic, e.g. in textual form). Signals Typed connections that carry a pseudo-continuous data flow. Connects the function blocks. set point Example (set point) (set point)
Industrial Automation
Industrial Automation
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 exception to this rule. In this case, the signal direction is identified by an arrow. (Some editors forbid retroactions - use variables instead).
a b
x z
Industrial Automation
1) Functions - are part of the base library. - have no memory. Example are: 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
The programmer chooses the blocks in a block library, similarly to the hardware engineer who chooses integrated circuits out of the catalogue.
This library indicates the pinning of each block, its semantics and the execution time. The programmer may extend the library by defining function block macros out of library elements. If some blocks are often used, they will be programmed in an external language (e.g. C, micro-code) following strict rules.
Industrial Automation
analog elements
GE GT LT LE greater equal greater than less than less equal
ADD
and or exclusive-or
adder
OR
XOR
TON IN Q PT ET
SUB
subtractor
timer on delay
MUL
multiplier divider
SR S1 R Q0 R_TRIG S1 Q0
CTU CU RESET Q ET PV
DIV
bool
SEL
integrator
int
MUX
75%
0% -25% Industrial Automation
5s
12s
exercise: build a tooth-saw (asymmetric) generator with the IEC 61131 elements of the preceding page
5s 75%
12s
0%
-25%
Industrial Automation
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
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 Programmable Logic Controllers 2.3 - 50
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
y T
Truth Table:
x1 x1 S R 0 0 1 1 x2 0 1 0 1 y previous state 0 1 1
x2
Mathematical Formula:
dx Kpx Kd Ki xd dt 0
Textual Description:
Calculates the root mean square of the input with a filtering constant defined in parameter FilterDelay
Programmable Logic Controllers 2.3 - 52
Industrial Automation
Industrial Automation
Function Block decomposition A function block describes a data flow interface. Its body can be implemented differently: Elementary block The body is implemented in an external language (micro-code, assembler, java, IEC 61131 ST):
procedure xy (a,b:BOOLEAN; VAR b,c: BOOLEAN); begin ...... .... end xy;
=
Compound block
The body is realized as a function block program . Each input (output) pin of the interface is implemented as exactly one input (output) of the function block. All signals must appear at the interface to guarantee freedom from side effects.
=
Industrial Automation Programmable Logic Controllers 2.3 - 54
Function Block segmentation An application program is decomposed into segments ("Programs") for easier reading, each segment being represented on one (A4) printed page. Within a segment, the connections are represented graphically . Between the segments, the connections are expressed by signal names .
Segment A X1 M2 M1 Y1
Segment B X2 M1 X3 M2 Y2
Industrial Automation
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
F1
X01
F2
F4 F3
X02 Y
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 x ms.
Industrial Automation
individual period
The function blocks are executed cyclically. all inputs are read from memory or from the plant (possibly cached) the segment is executed the results are written into memory or to the plant (possibly to a cache) The order of execution of the blocks generally does not matter. To speed up algorithms and avoid cascading, it is helpful to impose an execution order to the blocks.
Industrial Automation
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 means of a shared memories. Semaphores are not used since they could block an execution and make the concerned processes non-deterministic.
Industrial Automation
Program configuration
The programmer divides the program into tasks (sometimes called pages or segments), which may be executed each with a different period. The programmer assigns each task (each page) an execution period. Since the execution time of each block in a task is fixed, the execution time is fixed. Event-driven operations are encapsulated into blocks, e.g. for transmitting messages. If the execution time of these operations take more than one period, they are executed in background. The periodic execution always has the highest priority.
Industrial Automation
represented variables
FB
Industrial Automation
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
IN_1
OUT_1
The I/O blocks are configured to be attached to the corresponding I/O groups.
Industrial Automation
predefined addresses
Industrial Automation
Industrial Automation
Structured Text is a language similar to Pascal (If, While, etc..) The variables defined in ST can be used in other languages. It is used to do complex data manipulation and write blocs
Caution: writing programs in structured text can breach the real-time rules !
Industrial Automation
Data Types
Since 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.
Derived Types are user-defined and must be declared in Structured Text subrange, enumerated, arrays, structured types (e.g. AntivalentBoolean2) variable can receive initial values and be declared as non-volatile (RETAIN), so they can keep on after restart with the last value before power-down or reset.
Industrial Automation
Industrial Automation
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
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
SFC describes sequences of operations and interactions between parallel processes. It is derived from the languages Grafcet and SDL (used for communication protocols), its mathematical foundation lies in Petri Nets.
Industrial Automation
SFC: Elements
transitions
example transition condition Ec = ((varX & varY) | varZ)
states
Eb token
Sb
Sc
The sequential program consists of states connected by transitions. A state is activated by the presence of a token (the corresponding variable becomes TRUE). The token leaves the state when the transition condition (event) on the state output is true. Only one transition takes place at a time the execution period is a configuration parameter (task to which this program is attached)
rule: there is always a transition between two states, there is always a state between two transitions
Industrial Automation
State which come into existence with a token are called initial states.
All initial states receive exactly one token, the other states receive none.
Initialization takes place explicitly at start-up. In some systems, initialization may be triggered in a user program (initialization pin in a function block).
Industrial Automation
Sa
Eb
Sc
Ec
Sb Ed token forking : when the transition Ee is true, the token is replicated to all connected states
Note: transition is before the fork
Sd
Se Ee
Ef
token join : when all connected states have tokens and transition Eg is true, one single token is forwarded.
Note: transition is after the join
Sg
Sf Eg
Industrial Automation
State1
P0 State1_P0: do at leaving
P1 (pulse raise) action is executed once when the state is entered P0 (pulse fall) action is executed once when the state is left N (non-stored) action is executed continuously while the token is in the state P1 and P0 actions could be replaced by additional states. The actions are described by a code block written e.g. in Structured Text.
Industrial Automation
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
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)
Priority:
The alternative path most to the left has the highest priority, priority decreases towards the right.
Industrial Automation
SFC: Exercise
Variables: Input: In0, In1, In2, In3; Output: Trap = {0: closed; 1: open} Speed = {+20: +1 m/s; +1: +5 cm/s} Register = {0: closed; 1: open} negative values: opposite direction
In0
In1
In2
In3
Generates 1 as long as the tag of the vehicle (1cm) is over the sensor.
initially: let vehicle until it touches I0 at reduced speed 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. 4- Go back to I0 5 - Open the trap and wait 5s. repeat above steps indefinitely
Industrial Automation
S-element
The meta-symbols T and S define structures - they may not appear as elements in the flow chart. A flow chart may only contain the terminal symbols: state and transition
Industrial Automation Programmable Logic Controllers 2.3 - 79
::=
::=
transition OR:
OR:
OR:
OR:
OR:
state S-sequence
parallel paths
loop
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
A
a b
B
d
B
b
d c
C
c d
B'
A'
Industrial Automation
SFC: Complex structures These general rules serve to build networks, termed by DIN and IEC as flow charts
Many PLC applications mix continuous and discrete control. A PLC may execute alternatively function blocks and flow charts.
Industrial Automation
extern (ST)
function blocks
flow chart
Industrial Automation
A task can sometimes be written indifferently as function blocs or as flow chart. The application may decide which representation is more appropriate:
Flow Chart
Function Block
a "1" b c b d a
S R NOT c d
Industrial Automation
Flow Chart
init S R
Function Blocks
"1" A a B b C c
b a
&
S R & S R & c C B
Industrial Automation
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
The ladder logic is the oldest programming language for PLC it bases directly on the relay intuition of the electricians. it is widely in use outside Europe. It is described here but not recommended for new projects.
Industrial Automation
01
02
03
50
break contact (contact repos)
02 50 rung
05 44
Industrial Automation
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
Ladder logic (4) Binary combinations are expressed by series and parallel relay contact: ladder logic representation Series + 01 02 50 logic" equivalent 01 02 50
40
Industrial Automation
Ladder logic (5) The ladder logic is more intuitive for complex binary expressions than literal languages textual expression 1 2 3 5 4
50
6
12
50 2 3
10
6
11
!0 & 1 STR 2 & 3 / STR STR 4 & 5 STR N 6 & 7 / STR & STR STR 10 & 11 / STR & 12 = 50
Industrial Automation
Ladder logic (6) Ladder logic stems from the time of the relay technology. As PLCs replaced relays, their new possibilities could not be expressed any more in relay terms. The contact plan language was extended to express functions:
00
01 FUN 02 200
literal expression:
!00 & 01 FUN 02 = 200
The intuition of contacts and coil gets lost. The introduction of functions that influence the control flow itself, is problematic. The contact plan is - mathematically - a functional representation. The introduction of a more or less hidden control of the flow destroys the freedom of side effects and makes programs difficult to read.
Industrial Automation
Ladder logic provides neither: sub-programs (blocks), nor data encapsulation nor structured data types. It is not suited to make reusable modules. 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) used in manufacturing, not process control
Industrial Automation
Industrial Automation
Instruction Lists (1) (Instruktionsliste, liste d'instructions) Instruction lists is the machine language of PLC programming It has 21 instructions (see table)
Three modifiers are defined: "N" negates the result "C" makes it conditional and "(" delays it. All operations relate to one result register (RR) or accumulator.
Industrial Automation
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
Industrial Automation
A PLC programming environment (e.g. ABB ControlBuilder, Siemens Step 7, CoDeSys,...) allows:
- programming of the PLC in one of the IEC 61131 languages
Industrial Automation
symbols
laptop
code
variable monitoring and forcing for debugging
firmware
download
network
PLC
Industrial Automation
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
Not really: it does not support inheritance. Blocks are not recursive.
But it supports interface definition (typed signals), instantiation, encapsulation, some form of polymorphism.
Some programming environments offer control modules for better object-orientation
Industrial Automation
Industrial Automation
Event flow
*
Data flow
A research topic without real industry applications until now. reason: this is a non-deterministic system, difficult to understand.
Industrial Automation
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 ?
Industrial Automation
Industrial Automation
Industrial Automation
(e.g.10) In
ADD
Out (initially 2)
Industrial Automation
V1
L1
V2 upper lower MS
open V1 until tanks L1 indicates upper level open V2 during 25 seconds open V3 until the tanks L1 indicate it is void while stirring. heat mixture during 50 minutes while stirring empty the reactor while the drying bed in moving
V3
H1
temperature
V1
upper L1 lower V3
V2 L2 upper lower V3
V3
H1
temperature