sequential function chart - politecnico di...
TRANSCRIPT
Production Systems Control - Prof. Luca FerrariniA.A. 2011-2012
Automation Engineering 2011 - 2012
Production Systems Control
Sequential Function ChartProf. Luca FerrariniEng. Giancarlo Mantovani
Politecnico di Milano – Dipartimento di Elettronica e Informazione
A.A. 2011-2012 Production Systems Control - Prof. Luca Ferrarini 2
► Introduction
► Basic elements
► Basic operators
► Evolution rules
► LD and SFC
Elementi Base Operatori Base LD ed SFCIntroduzione Regole di Evoluzione
Index
A.A. 2011-2012 Production Systems Control - Prof. Luca Ferrarini 3
� History:
� SFC is a programming language defined in IEC61131 standard
� SFC was born from Grafcet, which is a representation language definedby AFCET (Association française pour la cybernétique économique et technique)
� SFC is its implementation as a Programming language for PLCs
Introduction
Basic elements Basic operators LD and SFCIntroduction Evolution rules
A.A. 2011-2012 Production Systems Control - Prof. Luca Ferrarini 4
� In 1975 in France, si a commitee was formed to define a newformalism
� Result: GRAFCET, from “GRaph” + AFCET (Association française de cybernétique économique et technique)
� In 1988 standard IEC 848 (International ElectrotechnicalComission) is defined:
� «Preparation of function charts for control systems», with name«Sequential Function Chart», based on grafcet
� In 1993 SFC is included in IEC61131-3 standard on PLCprogramming
History
Basic elements Basic operators LD and SFCIntroduction Evolution rules
A.A. 2011-2012 Production Systems Control - Prof. Luca Ferrarini 5
� SFC was born for the following reasons:
� Use formal models to represent control logics function for industrial automation
� Standardize representation formalisms
� Enrich automata with parallelism
� Simplify Petri nets in order to adapt them to industrial applications
� Be easily interpretable by control devices
Introduction
Basic elements Basic operators LD and SFCIntroduction Evolution rules
A.A. 2011-2012 Production Systems Control - Prof. Luca Ferrarini 6
Basic elements Basic operators LD and SFCIntroduction Evolution rules
Basic elements
� Few and simple ideas
� Step: sequence execution state
� Transition: passage between two steps during program execution
� Action: every step is associated with one or more actions to be performed
� Logic conditions: enables transition trigger, so execution evolution (true = transition triggered, false = transition stopped)
� Oriented arc: identifies passages between steps through a transition which is enabled by a logic condition
A.A. 2011-2012 Production Systems Control - Prof. Luca Ferrarini
Basic elements Basic operators LD and SFCIntroduction Evolution rules
Basic elements - Step
7
� Step:
� ID (usually an integer sequential number)
� Can be active or inactive
� Graphical representation: square (with double border if starting step)
� Has associated actions to be performed when the step is “active” serie di “azioni. To every action a qualifier is associated, specifyingexecution time or duration (N, S, P, etc.)
2Turn
Motor on
Step
Identifier
Active step is marked
X
Qualifier:• P Activation• N Deactivation• S Set• R Reset• …
Action
A.A. 2011-2012 Production Systems Control - Prof. Luca Ferrarini 8
� Qualifiers:
Elementi Base Operatori Base LD ed SFCIntroduzione Regole di Evoluzione
N Non-Store Action terminates when the step becomes inactive.
S Set (Stored)Actions continues even if the step becomes inactive and is terminated when the action is reset.
R Reset Terminates an action activated with qualifiers S, SD, SL or DS.
L Time LimitedAction is started when step becomes active and continues until the step becomes inactive or a certain time interval has passed.
D Time DelayedA timer is set when the step becomes active; if the step is still active and time is elapsed, the action is started and terminates when step goes inactive.
P PulseThe action is performed when the step goes active and is executed only once.
SDStored and time Delayed
The action is started with a time delay even if the step has gone inactive in the meanwhile and is performed until it is reset.
DSDelayed andStored
A timer begins counting when step becomes active. If the step is still active after timer completion, the action is started and carries on until is reset.
SLStored and time Limited
The action starts when the step becomes acrive and is carried on until it is not reset or a certain time is elapsed.
Basic elements - qualifiers
Basic elements Basic operators LD and SFCIntroduction Evolution rules
A.A. 2011-2012 Production Systems Control - Prof. Luca Ferrarini 9
Basic elements Basic operators LD and SFCIntroduction Evolution rules
Basic elements – Transitions
� Transitions
� Identifier
� Enabled or disabled
� Can be triggered
� Associated to a logic condition (or “receptivity”)
� Graphical representation: horizontal segment
C1 AND C2
Transizione Logic condition (receptivity)
A.A. 2011-2012 Production Systems Control - Prof. Luca Ferrarini 10
� Connection rules:
� A step can be directly connected only with transitions, not with steps; similarly, a transition can be directly connected with steps, not with other transitions.
� Graphical conventions:
� Arc with right angles
� Arc directed downwards: without arrow
� Arc directed upwards: with arrow
1
2
3
Start
Tank target level reached
ActivatePump P1
Switch-offPump P1
Basic elements – Oriented arc
Basic elements Basic operators LD and SFCIntroduction Evolution rules
Pump is off
A.A. 2011-2012 Production Systems Control - Prof. Luca Ferrarini 11
� In SFC it is possible to represent two basic features fordiscrete events systems:
� Choice (OR operators)
� Parallelism (AND operators)
� Graphical operators characterized by a “start” ( divergence )and an “end” ( convergence ) correspond to these two features
Basic operators
Basic elements Basic operators LD and SFCIntroduction Evolution rules
A.A. 2011-2012 Production Systems Control - Prof. Luca Ferrarini 12
� Choice start
� Two transitions after a single step
NOTE: mutual exclusion is necessary in order to have a deterministic behavior of the program
3
4 5
C1 NOT(C1)
Basic elements Basic operators LD and SFCIntroduction Evolution rules
Basic operators – Or divergence
A.A. 2011-2012 Production Systems Control - Prof. Luca Ferrarini 13
� Choice end
� A step with two transitions before
9 10
11
C1 C2
Basic operators – Or convergence
Basic elements Basic operators LD and SFCIntroduction Evolution rules
A.A. 2011-2012 Production Systems Control - Prof. Luca Ferrarini
� Parallelism start
� Simultaneous activation of more steps
14
15
13
14
Basic elements Basic operators LD and SFCIntroduction Evolution rules
Basic operators – AND divergence
A.A. 2011-2012 Production Systems Control - Prof. Luca Ferrarini
� Parallelism end
� Simultaneous deactivation of two or more steps (syncronization)
15
22
20 21
Basic operators – AND convergence
Basic elements Basic operators LD and SFCIntroduction Evolution rules
A.A. 2011-2012 Production Systems Control - Prof. Luca Ferrarini
� A transition is enabled (by the associated logic condition) if allthe steps before it are active
� A transition can be triggered if is enabled and its receptivityhas logical value true (the logic condition is verified)
16
22
20 21
Enabled
Evolution rules
Basic elements Basic operators LD and SFCIntroduction Evolution rules
A.A. 2011-2012 Production Systems Control - Prof. Luca Ferrarini
� Rule 1 – if a transition can be triggered, it is actually triggered :all steps before the transition are deactivated, while all steps after itare activated
� Rule 2 – all triggerable transitions in a certain time instant aretriggered at the same time
17
Evolution rules
Basic elements Basic operators LD and SFCIntroduction Evolution rules
A.A. 2011-2012 Production Systems Control - Prof. Luca Ferrarini
Transition enabled
� Transition triggering
18
17
15
16
Evolution rules – AND divergence
Basic elements Basic operators LD and SFCIntroduction Evolution rules
A.A. 2011-2012 Production Systems Control - Prof. Luca Ferrarini
� Transition triggering
Transition passed
19
Elementi Base Operatori Base LD ed SFCIntroduzione
17
15
16
Basic elements Basic operators LD and SFCIntroduction Evolution rules
Evolution rules – AND divergence
A.A. 2011-2012 Production Systems Control - Prof. Luca Ferrarini
� Transition triggering
20
22
20 21
Basic elements Basic operators LD and SFCIntroduction Evolution rules
Evolution rules – AND convergence
Transition enabled
A.A. 2011-2012 Production Systems Control - Prof. Luca Ferrarini
� Transition triggering
Transition passed
21
22
20 21
Basic elements Basic operators LD and SFCIntroduction Evolution rules
Evolution rules – AND convergence
A.A. 2011-2012 Production Systems Control - Prof. Luca Ferrarini
� Transition triggering
� C1 true, C2 false
3
4 5
C1 C2
22
Basic elements Basic operators LD and SFCIntroduction Evolution rules
Evolution rules – OR divergence
A.A. 2011-2012 Production Systems Control - Prof. Luca Ferrarini
� Transition triggering
� C1 true, C2 false
3
4 5
C1 C2
23
Basic elements Basic operators LD and SFCIntroduction Evolution rules
Evolution rules – OR divergence
A.A. 2011-2012 Production Systems Control - Prof. Luca Ferrarini
� Transition triggering
� C1 true, C2 true
3
4 5
C1 C2
24
Basic elements Basic operators LD and SFCIntroduction Evolution rules
Evolution rules – OR divergence
A.A. 2011-2012 Production Systems Control - Prof. Luca Ferrarini
� Transition triggering
� C1 true, C2 true
3
4 5
C1 C2
25
Basic elements Basic operators LD and SFCIntroduction Evolution rules
Evolution rules – OR divergence
A.A. 2011-2012 Production Systems Control - Prof. Luca Ferrarini
� Transition triggering
� C1 true, C2 true → Ambiguous situtation which can be solved with mutual exclusion or transition priority (interpretation depends on the PLC..)
3
4 5
C1 C2 AND NOT(C1)
26
Basic elements Basic operators LD and SFCIntroduction Evolution rules
Evolution rules – OR divergence
A.A. 2011-2012 Production Systems Control - Prof. Luca Ferrarini
� Note
� By applying evolution rules it can happen that a step (31) should be activated and deactivated at the same time
� Conventionally, this step stays active (if it has an associated action which is being performed, this action is not stopped and started again)
� But this situation should be used with caution…
27
30
31
32
C10
C11
C10 and C11both true
Basic elements Basic operators LD and SFCIntroduction Evolution rules
Evolution rules
A.A. 2011-2012 Production Systems Control - Prof. Luca Ferrarini
� Note
� By applying evolution rules it can happen that a step (31) should be activated and deactivated at the same time
� Conventionally, this step stays active (if it has an associated action which is being performed, this action is not stopped and started again)
� But this situation should be used with caution…
28
30
31
32
C10
C11
C10 and C11both true
Basic elements Basic operators LD and SFCIntroduction Evolution rules
Evolution rules
A.A. 2011-2012 Production Systems Control - Prof. Luca Ferrarini 29
SFC LD
PROs CONs PROs CONs
• Easier control logicsdesign
• Allows functionaldesign of projectspecifications
• The project has evena documentationfunction
• Easier maintainanceof already developedfunctions
• Even if it was bornmore than 25 yearsago and is present in IEC industrial standard, is notsupported by all PLCs
• Supported by allPLCs
• Really low levellanguage
• Difficult to read and so to maintain
• Not suitable forcomplex projects
Basic elements Basic operators LD and SFCIntroduction Evolution rules
LD vs SFC
A.A. 2011-2012 Production Systems Control - Prof. Luca Ferrarini 30
SFC LD
PROs CONs PROs CONs
• Easier control logicsdesign
• Allows functionaldesign of projectspecifications
• The project has evena documentationfunction
• Easier maintainanceof already developedfunctions
• Even if it was bornmore than 25 yearsago and is present in IEC industrial standard, is notsupported by all PLCs
• Supported by allPLCs
• Really low levellanguage
• Difficult to read and so to maintain
• Not suitable forcomplex projects
Basic elements Basic operators LD and SFCIntroduction Evolution rules
LD vs SFC
A.A. 2011-2012 Production Systems Control - Prof. Luca Ferrarini
T3
2 3
4
5 6
T1T2
1
T4
Cond1Cond2
Cond3Cond4
31
� Consider the generic step [4] of an SFC…
Basic elements Basic operators LD and SFCIntroduction Evolution rules
Boolean equivalent equations
A.A. 2011-2012 Production Systems Control - Prof. Luca Ferrarini 32
� State activation equation:� X4 = X1 • Cond1 + X2 • X3 • Cond2
� State permanence equation :� X4 = X4 • NOT (Cond3 + X5 • X6 • Cond4)
� Output equation (depends on qualifier):� N: Action4 = X4� ...
� Problem: they are not very readable and maintainable anditerpretation rules are missing…
Basic elements Basic operators LD and SFCIntroduction Evolution rules
Boolean equivalent equations
A.A. 2011-2012 Production Systems Control - Prof. Luca Ferrarini
� The formal representation of evolution (or interpretation ) rulesof an SFC program is called evolution algorithm (orinterpretation algorithm)
� In literature there are many alternatives for evolutionalgorithms, because the same program can be interpreted indifferent ways…
33
Basic elements Basic operators LD and SFCIntroduction Evolution rules
SFC interpretation
A.A. 2011-2012 Production Systems Control - Prof. Luca Ferrarini 34
1
2
3
A
B
Let’s make an example:� What if A and B are both verified?
Basic elements Basic operators LD and SFCIntroduction Evolution rules
SFC interpretation
A.A. 2011-2012 Production Systems Control - Prof. Luca Ferrarini 35
1
2
3
A
B
Let’s make an example:� What if A and B are both verified?� Step 2 would be activated and…
Basic elements Basic operators LD and SFCIntroduction Evolution rules
SFC interpretation
A.A. 2011-2012 Production Systems Control - Prof. Luca Ferrarini 36
1
2
3
A
B
� But “immediately” cannot be obtained with realdevices and in any case needs to be interpreted..
Basic elements Basic operators LD and SFCIntroduction Evolution rules
SFC interpretation
Let’s make an example:� What if A and B are both verified?� Step 2 would be activated and...� …”immediately” after it, step 3
A.A. 2011-2012 Production Systems Control - Prof. Luca Ferrarini
� Evolution algorithms without stability search
� Algorithmic representation of evolution rules such as in presence of transitions sequences with logic condition equal to true, they are triggered in different cycles, not in the same one
� All the outputs associated to intermediate steps are assigned (even if activation token stays in the step for an arbitrarily small time)
� Four steps for each cycle:1. Input scanning2. Triggerable transitions definition3. New state definition (due to transition trigger)4. Output writing
37
Basic elements Basic operators LD and SFCIntroduction Evolution rules
SFC evolution algorithms
A.A. 2011-2012 Production Systems Control - Prof. Luca Ferrarini 38
Steps initialization
Input scanning
Output writing
Input scanning
Triggerable transitions definition
New state definition
Output writing
Basic elements Basic operators LD and SFCIntroduction Evolution rules
SFC evolution algorithms
� Evolution algorithmwithout stability
search
A.A. 2011-2012 Production Systems Control - Prof. Luca Ferrarini 39
Steps initialization
Input scanning
Impulsive actions execution
Input scanning
Triggerable transitions definition
New state definition
Output writing
Varied condition
Impulsive actions execution
� Evolution algorithmwith stability search
Basic elements Basic operators LD and SFCIntroduction Evolution rules
SFC evolution algorithms
A.A. 2011-2012 Production Systems Control - Prof. Luca Ferrarini
� Ladder Diagram implementation of an SFC schema withoutstability search
� A memory bit is associated to each step (representing if thestep is active or not)
� A memory bit is associated to each transition (meaning that atransition is triggerable in a certain state)
� Program divided in 4 sections:1. Initialization2. Actions executions section3. Transitions evaluation secton4. Steps update section
40
Basic elements Basic operators LD and SFCIntroduction Evolution rules
SFC to LD translation – without stability search
A.A. 2011-2012 Production Systems Control - Prof. Luca Ferrarini
� Executed once: initializes to 1 initial steps:
41
W1LBL
W1
Initial_step_1
Initial_step_k
LBL
L
L
L
Basic elements Basic operators LD and SFCIntroduction Evolution rules
SFC to LD translation – [1] Initialization
JMP
A.A. 2011-2012 Production Systems Control - Prof. Luca Ferrarini
� For every action we need to perform these translation steps
� For every action with N qualifier , it is necessary to include a rung withinside all the steps performing that action, put under an OR condition.
� If the action is under other conditions (example: TIMER ), it isnecessary to include that condition in the rung (AND condition).
� For actions with set or reset qualifiers (S, R), Latch or Unlatch coils areneeded.
� For impulsive actions it is necessary to use positive/negative edgedetectors
42
Basic elements Basic operators LD and SFCIntroduction Evolution rules
SFC to LD translation – [2] Actions
A.A. 2011-2012 Production Systems Control - Prof. Luca Ferrarini 43
Step i Action A
Step j Tk
Step k
Step m
Step n
Action B
L
Basic elements Basic operators LD and SFCIntroduction Evolution rules
SFC to LD translation – [2] Actions
Perform Action A (N qualifier ) if you are in step i, k or in step j and Tk=1 (timer elapsed) (D/L qualifiers )
Start performing Action B (S qualifier ) when step m or n become active (until Action B is reset)
A.A. 2011-2012 Production Systems Control - Prof. Luca Ferrarini
� The bit associated to the transition is high if the transitio n istriggerable
� A rung is defined for each transition
44
Step i Step j Receptivity Transition A
Basic elements Basic operators LD and SFCIntroduction Evolution rules
SFC to LD translation - [3] Transitions
=
Receptivity
j
A
i
A.A. 2011-2012 Production Systems Control - Prof. Luca Ferrarini
� In correspondence of a triggerable transition:� 1 is written for steps after the transition (steps going active)� 0 is written for steps before the transition (steps going inactive)
45
Step i
Step j
Step k
Step m
L
L
U
U
Transition A
Basic elements Basic operators LD and SFCIntroduction Evolution rules
SFC to LD translation – [4] Steps update
A.A. 2011-2012 Production Systems Control - Prof. Luca Ferrarini
� Timing variables are made with non retentive timers which st artcounting when steps become active (D/L qualifiers )
� They can be put in a separated section
46
Step i
Tk5000
Basic elements Basic operators LD and SFCIntroduction Evolution rules
SFC to LD translation – Timing variables
A.A. 2011-2012 Production Systems Control - Prof. Luca Ferrarini
� T_tr bit means that “at least one transition has been triggered in this cycle during conditions evaluations”
� T_tr is activated during conditions evaluation if a transition is triggered (so the overall state has changed)
� IF T_tr==1 THEN JMP to Input scanning
� T_tr is unlatched at the beginning
47
T_tr
U
Step i
Step j
Step k
Step m
T_tr
L
L
L
U
U
Transition A
Basic elements Basic operators LD and SFCIntroduction Evolution rules
SFC to LD translation – Stability search algorithm
Input_Scanning
JMP
T_tr