ALSPA Control System Controcad SFC Sequential Language Behavior
ALSPA Control System Controcad SFC Sequential Language Behavior
Section 2
Section 3
Section 1
Section 2
Section 3
Section 1
Section 2
Section 3
Section 1
Section 2
Section 3
ALSPA Controcad
SFC
ACCESSIBILITY Free
DATE 2007-08-22
NAME SIGNATURE
CREATED BY S. COUFFIN
CHECKED BY L. HOLZ
APPROVED BY H. SABOT
DOCUMENT TYPE
ALSTOM DOCUMENT CODE
Copyright © ALSTOM 2007. We reserve all rights in this document and in the information contained therein.
Reproduction, use or disclosure to third parties without express authority is strictly forbidden
Template No.: CS-T-010 Rev.C (Procedure CS-P-009)
REVISION HISTORY
Copyright © ALSTOM 2007. We reserve all rights in this document and in the information contained therein. Reproduction, use or disclosure to third parties without express authority is strictly forbidden
Section 1 Foreword................................................................................................................. 5
Section 2 Elements of the Controcad SFC Editor................................................................. 6
2.1 Step ..........................................................................................................................................................6
2.1.1 Identification ..............................................................................................................................6
2.1.2 Initialization ...............................................................................................................................6
2.1.3 Step Activity Variable ................................................................................................................6
2.1.4 Elapsed Time since Step Activation Variable ...........................................................................6
2.1.5 Associated Comment................................................................................................................7
2.1.6 Associated Action and Forcing Order .......................................................................................7
2.1.7 Pit and Source Step ..................................................................................................................7
2.2 Transition..................................................................................................................................................7
2.2.1 Identification ..............................................................................................................................7
2.2.2 Transition Condition ..................................................................................................................7
2.2.3 Clearability ................................................................................................................................8
2.2.4 Transitions Belonging to a Sequence Selection .......................................................................8
2.2.5 Associated Comment................................................................................................................8
2.2.6 Pit and Source Transition..........................................................................................................9
2.3 Step-Transition Link..................................................................................................................................9
2.4 Forcing Order ...........................................................................................................................................9
2.4.1 Principle ....................................................................................................................................9
2.4.2 Consistency of the Forcing Order Hierarchy...........................................................................11
2.4.3 No Simultaneous Forcing Orders on the same SFC ..............................................................12
2.4.4 Effect on the Rules to update Situation ..................................................................................13
2.5 Boolean Action .......................................................................................................................................13
2.5.1 Principle ..................................................................................................................................13
2.5.2 Concrete Examples.................................................................................................................14
2.5.3 Correspondence between Standard Qualifiers and Controcad Qualifiers..............................14
2.5.4 Calculation of the Value of the Action Variable.......................................................................16
2.5.5 Behavior of an Action Associated to an Initial Step ................................................................17
2.5.6 Behavior of an Operation S Action of a Forced SFC ..............................................................17
2.5.7 Behavior of a Phase P0 Action in a Forced SFC....................................................................19
2.5.8 Associated Comment..............................................................................................................19
2.6 FBD Diagram Type Action......................................................................................................................19
2.6.1 Principle ..................................................................................................................................19
2.6.2 Warning: initialization code of FBs..........................................................................................20
2.6.3 Order of Boolean/FBD Actions................................................................................................20
2.6.4 Order of FBD Diagram Write/Execute Instructions .................................................................20
Section 3 Controcad Code Generation................................................................................ 22
3.1 SFC Diagram Structure ..........................................................................................................................22
3.1.1 Consistent SFCs .....................................................................................................................22
3.1.2 Composition of a POU integrating SFC Diagrams..................................................................22
3.1.3 Consistency of an SFC Type POU .........................................................................................22
3.1.4 Using the FBD.........................................................................................................................23
Copyright © ALSTOM 2007. We reserve all rights in this document and in the information contained therein. Reproduction, use or disclosure to third parties without express authority is strictly forbidden
Copyright © ALSTOM 2007. We reserve all rights in this document and in the information contained therein. Reproduction, use or disclosure to third parties without express authority is strictly forbidden
Section 1 Foreword
It was also decided to integrate to the greatest possible extent the needs of the
different users of Controcad.
The aim here is to present the functionality, especially the dynamic aspects, of the
Controcad sequential language.
This document presumes that the reader is familiar with the principles of GRAFCET
and SFC as these principles are formulated in the standards mentioned above.
For a better understanding of the document, it is recommended to read the
document PTP21-A40041 describing the main features of the SFC editor.
The user manual of the SFC editor describing the menus, the ways to manipulate
the SFC elements, … is included in the Controcad User's Manual, Volume 5,
Functional Study (document ref. PTP21A41005).
Copyright © ALSTOM 2007. We reserve all rights in this document and in the information contained therein. Reproduction, use or disclosure to third parties without express authority is strictly forbidden
2.1 Step
2.1.1 Identification
2.1.2 Initialization
Whether or not a step is initial defines whether or not it is active during the initial
controller cycle. Unlike the SFC and in compliance with GRAFCET practice, the
number of initial steps is free. It may even be null.
To enable the generation of code, a Boolean variable is linked to each step. The
value of this variable will be 1 when the step is active, and 0 when inactive.
• The ID tag identifies this variable absolutely relative to all the project variables.
The tag takes following form:
When necessary, a "time" type variable can also be associated to store the time that
the step has been active.
• This variable is optional.
• The ID tag identifies this variable absolutely relative to all the project variables
and takes the following form:
• The behaviors for this variable when the step is deactivated is: the variable retains
its value and is reset to zero on activation of its step. This allows the elapsed time
to be manipulated even after deactivation of the step.
Copyright © ALSTOM 2007. We reserve all rights in this document and in the information contained therein. Reproduction, use or disclosure to third parties without express authority is strictly forbidden
2.2 Transition
2.2.1 Identification
Each transition is identified by its number in the diagram that contains it.
This transition condition is a Boolean whose value is the result of an expression (by
default 1) defined in BEL (Boolean Expression Language).
BEL supports the following operators:
• Boolean expressions AND , OR, NOT, denoted . (AND ), + (OR) and / (NOT)
• Boolean expressions of rising and falling edges, denoted P1 (FM) and P0 (FD)
The Boolean AND has priority relative to the OR. Parentheses could be used to
express the desired priorities.
It is possible to define table type variables and therefore to manipulate "v(3)" type
expressions in these expressions.
Expressions can be reduced to operands only, expressed in the form of a variable or
an immediate Boolean value (0 for FALSE and 1 for TRUE) or an immediate
numerical value ( 33 or 3,14 ).
Copyright © ALSTOM 2007. We reserve all rights in this document and in the information contained therein. Reproduction, use or disclosure to third parties without express authority is strictly forbidden
2.2.3 Clearability
Copyright © ALSTOM 2007. We reserve all rights in this document and in the information contained therein. Reproduction, use or disclosure to third parties without express authority is strictly forbidden
An association between a step and a transition is called a link. A link is oriented and
may be displayed in the form of a connection (broken orthogonal line) or as a pair of
referrals (e.g. at the level of the step, a referral identifying the transition and at the
level of the transition, a referral identifying the step).
2.4.1 Principle
G2
1 G2
G1
1
G2
2 4
1
3 5 2 4
1
6 3 5
2 4
2
6
3 5
t+1
6
3 N F/G2:{3, 6}
t+2
t+3
Copyright © ALSTOM 2007. We reserve all rights in this document and in the information contained therein. Reproduction, use or disclosure to third parties without express authority is strictly forbidden
G2
1 G2
G1
1
G2
2 4
1 3 5 2 4
1
6 3 5
2 4
2
6
3 5
t+1
6
3 P1 F/G2:{3, 6}
t+2
t+3
Copyright © ALSTOM 2007. We reserve all rights in this document and in the information contained therein. Reproduction, use or disclosure to third parties without express authority is strictly forbidden
G1 G2
1 10 31
1
2 20
2 32 34
3
3 N F/G2:{3, 32, 34} 33 35
36
Forcing orders are processed before actions (Boolean and FBD type).
This example shows a forcing chart whose nodes are SFCs and where the arcs
from one node to another correspond to at least one forcing order from the outgoing
SFC to the incoming SFC.
G1
G2
G4 G3
G5 G6
There must be no loops in this forcing chart. The presence of loops is a criterion for
the shutdown of code generation.
Copyright © ALSTOM 2007. We reserve all rights in this document and in the information contained therein. Reproduction, use or disclosure to third parties without express authority is strictly forbidden
It is therefore important that an SFC should not be subject at the same time to two
or more forcing orders that may well be contradictory.
All the forcing orders on the same forced SFC are therefore structured into a
prioritizing hierarchy. These orders can be transmitted from several actions in
several steps of several SFCs. This hierarchy exists within the SFC and also among
all the SFCs. The hierarchy exists by default and can be redefined by the user.
Thus, if two forcing orders on the same SFC happen to have active associated
steps, only one order will be transmitted, i.e. that with the highest priority in the
hierarchy.
G1
1
G2
2 1 N S A
3 N F/G2:{3, 6}
2 4
Priority 2
3 5 N R A
G3
1 6
2 N F/G2:{1}
Priority 1
It is possible to display (in a window) the list of the forcing orders that may apply to
the SFC (« Cross References » menu on the SFC diagram).
Copyright © ALSTOM 2007. We reserve all rights in this document and in the information contained therein. Reproduction, use or disclosure to third parties without express authority is strictly forbidden
2.5.1 Principle
The action qualifiers defined in SFC do not meet the needs of ours users, that’s the
reason why Controcad defines specific action qualifiers:
• the step activity point at which the operation must take place. This point may also
be known as the action ordering moment:
For reasons of security, reset to zero (R) operations take priority over other
operations (S and C).
• the existence of an additional condition before the operation can take place. This
condition is expressed via BEL language.
1
Unit parameterizable by project or POU among 10, 100 or 1000 ms.
Copyright © ALSTOM 2007. We reserve all rights in this document and in the information contained therein. Reproduction, use or disclosure to third parties without express authority is strictly forbidden
E -------- D/10 s | C | A
None N C
N N C
R N R
S N S
L L C
D D C
P P1 C
SD Feasible in another way
DS D S
SL Feasible in another way
P12 P1 C
P02 P0 C
The qualifiers SD and SL cannot be defined in Controcad in SFC only, but they can
be defined by means of an SFC/FBD description.
Some Controcad qualifiers have no equivalent in the standard. These are:
• P1 | S,
• P1 | R,
• P0 | S,
2
Second edition of the standard only.
Copyright © ALSTOM 2007. We reserve all rights in this document and in the information contained therein. Reproduction, use or disclosure to third parties without express authority is strictly forbidden
• L | S,
• L | R,
• D | R.
• P0 | R,
• P0 | C.
3
UTE C03-191 document only.
Copyright © ALSTOM 2007. We reserve all rights in this document and in the information contained therein. Reproduction, use or disclosure to third parties without express authority is strictly forbidden
This calculation is linked to a 'ordering status' for each action, i.e. to TRUE if any
associated condition is at TRUE and if:
• the ordering moment is N when the step is active,
Important: the utilization of this ordering status implies that the variable associated
to the action may switch to TRUE when the step is inactive. This is a behavior at the
limit of the basic principles of the SFC/GRAFCET.
• OR if the ordering moment is D and the step has been active for a longer period
than the specified delay time,
• OR if the ordering moment is L and the step has been active for a shorter period
than the specified limitation time.
At any given moment, some of the Boolean actions manipulating the same variable
will have TRUE ordering status and others FALSE ordering status.
• if the ordering status of all these actions is FALSE, the variable is equal to 0
(unless it has been previously memorized at 1).
• when the ordering status of some of these actions is TRUE, if at least one of
these actions is type R, the variable is memorized at 0; or if at least one of these
actions is type S, the variable is memorized at 1; otherwise the variable is set
(without memorization) to 1.
Further information
For the actions of the same SFC, the three following resultants are produced:
• Resultant RSE_S from the ordering status with the SET operation, which is TRUE
if at least one SET ordering status is TRUE. If there is no action ordering status
with a SET operation a FALSE value is given to the resultant.
• Resultant RSE_R from the ordering status with the RESET operation, which is
TRUE if at least one RESET ordering status is TRUE. If there is no action
ordering status with a RESET operation a FALSE value is given to the resultant.
• Resultant RSE_C from the ordering status with the C operation, which is TRUE if
at least one C ordering status is TRUE. If there is no action ordering status with a
C operation a FALSE value is given to the resultant.
The value of the action variable is then calculated as follows via the introduction of a
additional state_action Boolean.
The number of controller cycles executed is designated K. The current cycle is taken
into account.
If first cycle
State_action(1) = FALSE
Else
State_action(k) = ( RSE_S + State_action(k-1) ) . / RSE_R
End if
Copyright © ALSTOM 2007. We reserve all rights in this document and in the information contained therein. Reproduction, use or disclosure to third parties without express authority is strictly forbidden
The clearability of transitions is calculated and the new step variable values are
updated before any calculation of the ordering status of the actions.
This means that the actions associated to the initial steps are not necessarily
executed, in particular if the situation of the SFC has changed during the first cycle.
We have chosen not to prejudge the causes of step inactivity in establishing the
ordering status of the actions.
Copyright © ALSTOM 2007. We reserve all rights in this document and in the information contained therein. Reproduction, use or disclosure to third parties without express authority is strictly forbidden
G1
1 N S A
2 4
2
3 5 N R A
3 N F/G2:{3, 6}
Copyright © ALSTOM 2007. We reserve all rights in this document and in the information contained therein. Reproduction, use or disclosure to third parties without express authority is strictly forbidden
We have chosen not to prejudge the causes of step inactivity in establishing the
ordering status of the actions.
Concrete example: SFC G1 including step 3 forces SFC G2 to the situation {step 3,
step 6}. We suppose that at the start, step 3 of G1 is inactive and step 1 of G2 is
active. An action in step 1 of G2 executes a P0 on Boolean variable A. Then SFC
G1 updates and step 3 of G1 becomes active. SFC G2 is therefore forced to active
steps 3 and 6, and step 1 deactivates. This becomes variable A ? Variable A
switches to TRUE for 1 cycle.
G2
G1
1 P0 C A
2 4
2
3 5
3 N F/G2:{3, 6}
2.6.1 Principle
In the SFC, an action may correspond to a program, i.e. a list of instructions, whose
execution is conditioned by the activity of the step. This list of instructions is the
code equivalent to the function of a Controcad FBD. A diagram type action, also
called an FBD type, is therefore a sort of Boolean action but, instead of specifying a
Boolean variable, the user specifies an FBD diagram identified by its name.
Copyright © ALSTOM 2007. We reserve all rights in this document and in the information contained therein. Reproduction, use or disclosure to third parties without express authority is strictly forbidden
• the behavior of the SFC actions should not prejudge knowledge of whether the
causes of step activation/deactivation are or are not the result of forcing orders.
The action emission mechanism for FBD actions associated to SFCs implies that
the initialization code of FBs is only executed if the FBD action is emitted at the
initial execution cycle of the PLC (i.e. if the action to which the FBD is associated is
active at initialization).
We have chosen, after determining the new situation and the ordering status of the
Boolean and FBD actions, to process all the Boolean actions of the SFC POU then
all the FBD actions of the SFC POU.
The prioritization of the execution of the FBD diagrams in the POU depends on the
ordering moments of the actions. This order is important as it may influence the
value of a variable produced in two distinct diagrams or even produced in one
diagram and read in the second. This means that the action variables are prioritized
by category taking:
• first those that have at least one P0 phase action
• then those that have at least one P1 phase action, and are not included in the
above
• then those that have at least one L phase action, and are not included in the
above
• then those that have at least one phase N action, and are not included in the
above,
• finally the others, i.e. those that have only phase D actions.
Within a category the execution order of the FBDs is defined by the user (execution
number of the FBDs in the POU).
Copyright © ALSTOM 2007. We reserve all rights in this document and in the information contained therein. Reproduction, use or disclosure to third parties without express authority is strictly forbidden
G1 G1
1 N F/G2:{6} 1 N F/G2:{6}
N C fbd1 N C fbd1
P0 S fbd2 P0 S fbd2
2 P1 C fbd3 2 P1 C fbd3
3 3
t t+1
Copyright © ALSTOM 2007. We reserve all rights in this document and in the information contained therein. Reproduction, use or disclosure to third parties without express authority is strictly forbidden
Unlike FBD diagrams, the code corresponding to several SFCs may not be
generated diagram by diagram because of SFC behavioral rules. It is therefore
necessary to provide an entity that can be used to group the different SFCs that are
correlated among themselves:
• by common actions (Boolean or FBD),
• A ordered list of the FBD actions in the consistent SFCs specified above.
The user defines the SFC set that he needs to see in the POU (complying
nevertheless with the restrictions defined in 3.1.1 and the restrictions imposed by
the used PLC).
The SFCs have no execution number in the POU because the execution order of
the SFCs is defined by the forcing hierarchy. The execution numbers of the FBDs in
the POU are used to define the execution order of the FBDs in a category (see in
paragraph 2.6.4).
If the inter-correlated SFCs are not in the same POU, the generation of the POU is
disabled by Controcad since the results can only be bad.
An FBD diagram that is not an action of an SFC of the POU can not be in the POU
(its code could never be executed since it is never be emitted by an action).
Copyright © ALSTOM 2007. We reserve all rights in this document and in the information contained therein. Reproduction, use or disclosure to third parties without express authority is strictly forbidden
• or cyclically by the principal program (for an FBD that is not an action of an SFC).
Copyright © ALSTOM 2007. We reserve all rights in this document and in the information contained therein. Reproduction, use or disclosure to third parties without express authority is strictly forbidden
Copyright © ALSTOM 2007. We reserve all rights in this document and in the information contained therein. Reproduction, use or disclosure to third parties without express authority is strictly forbidden