Module 3.
IEC Language : SFC
Unity training course V1.0 - Module 3.A : IEC Language SFC 1
What is SFC ?
SFC : Sequential Function Chart
Graphic method of representing a sequential
control system by using a sequence of steps
and transitions
Each step is a command or action that is either
active or inactive
The flow of control passes from one step to
the next through a conditional transition that is
either true or false
Standard IEC 1131-3
Unity training course V1.0 - Module 3.A : IEC Language SFC 3
SFC rules
Sequential program is composed of :
SFC sections (top level)
Action sections
Transition sections
SFC sections are only allowed in the MAST task
Each SFC section contains one or several SFC graphs
A SFC section has 200 rows and 32 columns
A SFC section can contain 1024 steps
Unity training course V1.0 - Module 3.A : IEC Language SFC 4
Steps
A SFC section is a "state machine"; the state being define by the
active steps (100 steps maximum in multiple token)
Normal step
Becomes active when the prior transition is true
Becomes inactive when the succeeding transition is true
Each step contains none, one or several actions
Initial step
Starts the sequence when the application is initialized
Don't contain action
One initial step must be defined in each sequential chain
(graph)
Qualifier can be declared for each step
A supervision and a delay times can be defined for each step
Unity training course V1.0 - Module 3.A : IEC Language SFC 5
Macro step
Macro step
Use to call the macro step sections
The macro step sections must be activated
in the Tools Project Settings
Input step
First step of a macro step section
The IN step is automatically created
Cannot be deleted or inserted
Output step
Last step of a macro step section
The OUT step is automatically created
Cannot be deleted or inserted
Unity training course V1.0 - Module 3.A : IEC Language SFC 6
Transition
For each transition the condition can be :
A boolean variable
A transition section
– Transition condition is edited using the LD, FBD, ST
or IL language
– The result of the evaluation of the transition condition
is assigned to a boolean variable with the same name
as the transition itself
Unity training course V1.0 - Module 3.A : IEC Language SFC 7
Jump
To represent a direct link which is not drawn in its full
length
Can be placed in all places in a chart but after a transition
Several jumps are possible to the same target
Unity training course V1.0 - Module 3.A : IEC Language SFC 8
Alternative branch / joint
Alternative branch (OR divergence)
The branch to execute is determined by the result of
each transition condition following the alternative
branch
The branch transition conditions are processed from
left to right
Alternative joint (OR convergence)
The different sequences are joined again into one
branch where processing continues
Normally one step is allowed after an alternative joint
A parallel branch is also allowed after an alternative
joint
Unity training course V1.0 - Module 3.A : IEC Language SFC 9
Parallel branch / joint
Parallel branch / joint
Processing is split up into several sequences (32 maximum)
The parallel sequences are processed independently from left to
right
Normally one transition is allowed above a parallel branch
An alternative joint is also allowed above a parallel branch
Parallel joint (AND convergence)
Combine the parallel sequences to one branch
The transition following a parallel joint is evaluated when all the
predecessor steps have been set (synchronization of the
parallel sequences)
Normally one transition is allowed after a parallel branch
An alternative branch is also allowed after a parallel joint
Unity training course V1.0 - Module 3.A : IEC Language SFC 10
Sequences
To minimize the object creation structure sequences are
proposed
Simple sequence
– Beginning with a step / with a transition
Parallel sequence with step (s) containing
– AND divergence
– Branches
– AND convergence
– Final transition
Selection sequence with transition (s) containing
– OR divergence
– Branches
– OR convergence
– Final step
Unity training course V1.0 - Module 3.A : IEC Language SFC 11
Links
Direct link connects a step to a transition or a
transition to a step
Link exists only if the source and destination
already exist
Link never connects step to step or transition to
transition
Link never overlaps another object (step, transition,
jump)
Links can overlap or cross each other
A link is composed of orthogonal segments
An arrow indicated that the link is from bottom to
top
Unity training course V1.0 - Module 3.A : IEC Language SFC 12
SFC Editor
Freeform editor based on Window Multiple Document Interfaces
Opening a chart section or a macro expansion section launch the
editor
A cell can contain every type of objects (the lines are not
dedicated for step or transition)
A section has 200 rows and 32 columns
Unity training course V1.0 - Module 3.A : IEC Language SFC 13
Objects of a SFC program
Step
Macro step
Transition
Jump
Alternative branch / Alternative joint (OR divergence /
convergence)
Parallel branch / parallel joint (AND divergence / convergence)
Link
Comment
Simple sequence beginning with step / transition
Parallel sequence / selection sequence
Unity training course V1.0 - Module 3.A : IEC Language SFC 14
Normal / Expanded View
Normal view Expanded view
Expanded view of the section displays the action list of the
steps
Zooms can be applied to the editor
Unity training course V1.0 - Module 3.A : IEC Language SFC 15
Steps naming
The steps naming is IEC like
The step name is automatically generated and can be
edited (free name)
A step name must be unique throughout the entire
project
Step name length is 32 characters maximum
Automatically generated step name has the following
structure : S_n_m (for step) or MS_n_m (for macro
step)
– S = Step or MS = Macro Step
– n = number of section (consecutive number)
– m = number of step in the section (consecutive
number)
Unity training course V1.0 - Module 3.A : IEC Language SFC 16
Step properties
3 tabs to define the step properties
General
Step name
Initial step attribute
Supervision times and delay
time
– Literal form (ie 10 ms)
– SFCSTEP_TIMES variable
Actions
Qualifier
Action time
Action type (variable, direct
address, section)
Comment
Unity training course V1.0 - Module 3.A : IEC Language SFC 17
Step times
Delay time < Minimum Supervision Time < Maximum
Supervision Time
Maximum Supervision Time
Maximum time for which the step should be active
If step is active after this time :
– Error message
– The step is colored in magenta (animation mode)
Minimum Supervision Time
Minimum time for which the step should be active
If step becomes inactive before this time :
– Error message
– The step is colored in yellow (animation mode)
Delay time (step dwell time)
Minimum time for which the step must be active
Unity training course V1.0 - Module 3.A : IEC Language SFC 18
Qualifiers
Define the control for the action linked to a step
None / N : action is set (1) when the step is active
R (Reset) : action is reset (0) when the step is active
S (Set) : action is set and remains at 1 even if the step becomes
inactive
L (time Limited) : action is set during active period of the step
D (Delayed) : action will be set after a time duration and remains
at 1 during active period of the step
P (Pulse) : the action is set when the step is active and remains
at 1 for one program cycle
DS (Delayed and Set) : action is set after a time duration and
remains at 1 even if the step becomes inactive. If the step
becomes inactive before the time has elapsed the action is not
set
Unity training course V1.0 - Module 3.A : IEC Language SFC 19
Qualifiers (cont)
Define the control for the action linked to a step
P1 (Plus, positive edge) : the action is set for one program
cycle when the step is active (0 -> 1 edge)
P0 (Plus, negative edge) : the action is set for one
program cycle when the step is active (1 -> 0 edge)
Unity training course V1.0 - Module 3.A : IEC Language SFC 20
Transition properties
Bool variable (ie Valve_1)
Bool value (0 or 1)
Bool address (%M, %I, ...)
2 pages to define the transition properties
Invert transition condition (active at 0)
Type of transition condition (transition section or variable)
Comment
Unity training course V1.0 - Module 3.A : IEC Language SFC 21
Transition section
In IL and ST, it contains a logic expression of which the
result is automatically assigned to the transition variable
(ie. memory assignment ST not allowed in IL, assignment
instruction := not allowed in ST)
Unity training course V1.0 - Module 3.A : IEC Language SFC 22
Transition section (cont)
In FBD, it contains a AND block with output linked to transition
variable
In LD, it contains a network with a coil linked to transition
variable
Unity training course V1.0 - Module 3.A : IEC Language SFC 23
Jump properties
2 pages to define the jump properties
Jump target (step or macro step name)
Comment
Unity training course V1.0 - Module 3.A : IEC Language SFC 24
Branch / joint properties
"Handles" to adjust the size to the desired
length
Branch properties dialog box
Number of output pins (size of the object)
Position of the input pin
Joint properties dialog box
Number of input pins (size of the object)
Position of the output pin
Unity training course V1.0 - Module 3.A : IEC Language SFC 25
Colors of SFC objects
The colors are use when the section is animated
Step
– Green : step is active
– White : step is inactive
– Yellow : step time is smaller than the minimum
supervision time
– Magenta : step time is greater than the maximum
supervision time
Macro step
– Green (upper part) : macro step becomes active
– Green (upper and lower parts) : OUT step of the macro
is active
– White : macro step time is inactive
– yellow : macro step time is smaller than the minimum
supervision time
– Magenta : macro step time is greater than the
maximum supervision time
Unity training course V1.0 - Module 3.A : IEC Language SFC 26
Colors of SFC objects (cont)
The colors are use when the section is animated
Transition linked to a boolean variable or a simple boolean
expression
Green : boolean variable or expression is TRUE
Red : boolean variable or expression is FALSE
Transition linked to a section
Black : prior step is inactive
Green : conditions of the section are TRUE
Red : conditions of the section are FALSE
Unity training course V1.0 - Module 3.A : IEC Language SFC 27
Single-token execution
Only one initial step
One step is active except in parallel branches (one
step per branch)
A transition is evaluated if the previous step is active
Branch transitions are processed from left to right
Only one branch is active in alternative branches
With parallel branches a transition activates several
steps (32 max)
Jumps into or out of a parallel branch are not
possible
Unity training course V1.0 - Module 3.A : IEC Language SFC 28
Multiple-token execution
Several initial steps (0 to 100)
A macro step can contains initial steps
Several steps are active at same time
A transition is evaluated if the previous step
is active
More than one branch can be active in
alternative branches
With parallel branches a transition activates
several steps
Jumps into or out of a parallel branch are
possible
Steps are activated from a non-SFC section
(SETSTEP block)
Unity training course V1.0 - Module 3.A : IEC Language SFC 29
Chart system objects
The system objects to manage the chart are replaced by EF /
EFB
PL7 object Function Replace by
%S21 Clear all seps + set INIT (SFCCNTRL EFB)
all initial steps INITCHART function
%S22 Clear all steps CLEAR (SFCCNTRL EFB)
CLEARCHART function
%S23 Freeze all steps DISTRANS (SFCCNTRL EFB)
FREEZECHART function
%S24 Clear all macro-steps INIT (SFCCNTRL EFB)
%SW22 - 25 Macro-step clearing INITCHART function
%S26 Sequence error Event viewer
%SW125 - 127
%SW20 Number of active No equivalent
%SW21 Number of valid No equivalent
Unity training course V1.0 - Module 3.A : IEC Language SFC 30
New features from Grafcet
Several SFC sections are possible
PRL/GRAPH/POST sequence does not exist.
PRL and POST are replaced by non-SFC
sections
Multiple token (several steps active at same
time)
Initial step inside a macro section
Setting and resetting of steps is possible in all
sections (except SFC action and subroutine
sections) (only in PRL with Grafcet)
Unity training course V1.0 - Module 3.A : IEC Language SFC 31
On-line Modifications
Full modifications in online mode
SFC section can be created in online mode
SFC steps can be :
Added
Modified the properties and actions
Deleted
SFC transitions can be :
Added
Modified the type and expression
Deleted
Unity training course V1.0 - Module 3.A : IEC Language SFC 32