Chapter 11 - Sequential Function Chart - SFC - V2-1 PDF
Chapter 11 - Sequential Function Chart - SFC - V2-1 PDF
TABLE OF CONTENTS
Chapter 11 Sequential Function Chart (SFC).............................................................................................................................. 11-1
11.1 General Information......................................................................................................................................................... 11-3
11.1.1 Description ................................................................................................................................................................ 11-3
11.1.2 Objectives.................................................................................................................................................................. 11-3
11.1.3 Reference Documentation......................................................................................................................................... 11-3
11.1.4 Steps to go ................................................................................................................................................................. 11-3
11.2 SFC Handling................................................................................................................................................................... 11-4
11.2.1 Create SFC ................................................................................................................................................................ 11-4
11.2.2 Copy / Paste SFC ...................................................................................................................................................... 11-4
11.2.3 Delete SFC ................................................................................................................................................................ 11-4
11.2.4 Insert Branch ............................................................................................................................................................. 11-4
11.2.5 Delete Branch............................................................................................................................................................ 11-6
11.3 SFC Language.................................................................................................................................................................. 11-8
11.3.1 General ...................................................................................................................................................................... 11-8
11.3.2 The SFC Editor ......................................................................................................................................................... 11-8
11.3.3 Sequential Rules...................................................................................................................................................... 11-10
11.3.4 Sequence Constructs ............................................................................................................................................... 11-10
11.3.5 Online Functions ..................................................................................................................................................... 11-12
11.4 Advanced Sequence Constructs..................................................................................................................................... 11-14
11.4.1 Simultaneous Sequences......................................................................................................................................... 11-14
11.4.2 Sequence Selection ................................................................................................................................................. 11-14
11.4.3 Jumps and Destinations .......................................................................................................................................... 11-14
11.4.4 Subsequence............................................................................................................................................................ 11-14
11.5 Sequence Control Variables........................................................................................................................................... 11-15
11.5.1 Automatically Generated Variables........................................................................................................................ 11-15
11.5.2 Step Timing Variables ............................................................................................................................................ 11-15
11.5.3 Different Methods for Activating Outputs ............................................................................................................. 11-16
11-1
11-2
11.1.2 Objectives
On completion of this chapter you will be able to:
11.1.4 Steps to go
1. Create a new program or single control module
2. Open the POU (Program Organization Unit) editor
3. Change the language of the POU editor to SFC
4. Create the chain
5. Program the steps and transitions
6. Save the chain
7. Test the chain
11-3
11-4
Right
click
2. Select the entry Step, Transition to insert a new step with its transition
11-5
2. Open the context menu for the transition Tr3 and select the entry Delete.
11-6
11-7
11-8
Menu Command
Description
Inserts a jump.
11-9
11.3.4.1 Steps
A step is a basic element, which is activated by its preceding transition.
The step becomes active until its succeeding transition is true, and then
next step is activated.
Each step has a name, that can be changed, and each step can have up
to three associated set of actions.
11.3.4.2 Action
An action is a code block, written in the Structured Text (ST). An action can have an
action qualifier, specifying how and when the action code is to be executed. The
names of the actions are automatically generated. The actions will be named step
name_action qualifier, for example, see figure below. If the step name is
changed, the action names are automatically changed. It is not possible to change the
action names.
11-10
The N action qualifier stands for Non-stored, and means that the action code is
executed continuously, while the step is active.
The P1 action qualifier stands for Pulse rising edge, and means that the action code
is executed once, when the step becomes active.
The P0 action qualifier stands for Pulse falling edge, and means that the action
code is executed once, when the active step becomes inactive.
Using the ST language, you write code in the code pane for each of the three action
boxes. Any of the three may be left empty or even deleted. Each action can execute
any number of statements.
11.3.4.3 Transitions
The transition from one step to the next, is controlled by transition conditions, which
are boolean expressions including process signals.
The state of the sequence changes, when a transition condition becomes true. The
sequence evolution is controlled by Sequence Control Variables (for example,
StepName.X and StepName.Reset).
When a transition condition becomes true and the preceding step(s) is active (that is,
the transition can fire), the actions are executed in the following order during that
scan:
During scans when no transition condition becomes true, only N actions associated to
active steps will execute. A step is active when the step variable (discussed later)
StepName.X is true
11-11
Disable Actions
Show Actions
Block Transitions
Reset
Force Forward
Force Backward
11-12
Menu Command
Description
11-13
11.4.4 Subsequence
For documentation and overview reasons, it is sometimes convenient to graphically
structure the sequence into smaller parts, subsequences, thus hiding details until they
are requested. The subsequence is usually put around a sequence part, which performs
a set of logically related actions. The subsequence function is a way to structure the
sequence using a graphic hierarchy. The sequence can be graphically structured into
any number of hierarchical levels.
11-14
Type
Menu
Access*
SequenceName.Reset
Bool
Yes
SequenceName.Hold
Bool
Yes
SequenceName.Disable
Bool
Yes
Bool
No
Actions
StepName.X
Description
* A Yes in the Menu Access column means that the variable can be enabled by a menu
selection from the Tools menu in the online mode.
Time
Type
Description
SequenceName.Check
Bool
SequenceName.StepTimedOut*
Bool
11-15
StepName.T
Time
11.5.3.1 In Actions
When a step is active is the N code action of the step also activated. For example if the
statement
Count := Count +1;
is written in an N action, the code is executed once every cycle while the step is
active. The advantage of writing activation code in the actions of the step, is that all
code associated with this step is kept in one place.
This statement is written in another code block than the SFC sequence. The advantage
for this is that all activation code associated with the entire sequence could be
collected in one code block, instead of being scattered among the actions for all steps.
In the example above it is easy to find the reason for why the Start variable is true or
false: it depends on whether the step StartMotor is active or not.
11-16