SFC Editor
General information about editing in SFC......................................................................................1
Actions and transition details................................................................................................1
Inserting a first SFC network, steps and transitions.............................................................1
Changing a normal step into an initial step and vice versa..................................................3
Dialog 'Step'...........................................................................................................3
Inserting jumps while editing SFC........................................................................................4
Dialog 'Jump/End step insert control'.....................................................................4
Inserting end steps...............................................................................................................5
Inserting action blocks..........................................................................................................5
Associating a new inserted action detail to a step................................................................6
Changing the properties of a step........................................................................................6
Changing the properties of a transition................................................................................6
Dialog 'Transition'...................................................................................................7
Changing the properties of an action block..........................................................................7
Calling a code body of a transition or an action...................................................................7
Inserting branches using the icon 'Insert branch'.................................................................8
Example figures for alternative and simultaneous branches.................................8
Dialog 'Divergence'..............................................................................................10
Inserting branches using the SFC branch edit mode.........................................................10
Inserting variables for actions in SFC.................................................................................11
How to insert a variable for an action which has been declared before...............12
How to declare and insert a new variable for an action.......................................12
Changing variables for actions in SFC...............................................................................13
Inserting variables for transitions in SFC............................................................................14
How to insert a variable for a transition which has been declared before............14
How to declare and insert a new variable for a transition....................................15
Changing variables for transitions in SFC..........................................................................17
Calling functions and inserting contacts/coils in SFC.........................................................18
Optimizing SFC lines after deleting....................................................................................18
i
General information about editing in SFC
In the graphic editor you can edit in the programming language SFC using different features.
One of the main characteristics of editing in SFC is that the programming system always tends to
create a closed network. While inserting new steps and transitions the part of the network under the
insertion point is pushed automatically downwards. This automatically moving only works in the
vertical sense. While inserting branches you have to organize the structure of networks by yourself
to get horizontally enough space for inserting.
In order to edit an SFC code body worksheet you first have to open the corresponding worksheet in
the project tree by double clicking on the desired icon.
Direct connections are transitions with variables or FBD objects with no own code body as
transition condition.
Actions can be a Boolean variable or a code body edited in IL, ST, LD or FBD. If the action has its
own code body it is called detail. An action always has an associated action qualifier.
1
General information about editing in SFC General information about editing in SFC
In one worksheet you can have only one SFC network which can be combined with an FBD
network and/or an LD network but not with another SFC network.
If you have checked the menu item 'Fixed SFC objects width' in the submenu 'Layout' the width of
steps and actions is always the same. If not the width is adjusted according to the length of the
name of the step or action.
The following figure shows an SFC network with one initial step (S001), the corresponding action
block (A001) and one transition (T001).
• Click on the step, the new transition and step will succeed.
Another transition and step is inserted between the marked step and the next transition.
• Repeat the steps for each additional step and transition pair.
If you mark a transition instead of a step and you insert a new step−transition−sequence, the new
step and transition is inserted below the marked transition.
In the following sample network, three new step−transition−sequences were inserted by marking
step S001 and then pressing the icon/shortcut three times. Thus, the new sequences are inserted
between step S001 and transition T001.
2
General information about editing in SFC Changing a normal step into an initial step and vice versa
How to proceed:
• Activate the checkbox 'Initial step' to change a normal step into an initial step.
The initial step is represented in your worksheet with a double−line rectangle.
• Deactivate the checkbox 'Initial step' to change an initial step into a normal one.
The normal step is represented in your worksheet with a single−line rectangle.
Dialog 'Step'
The dialog 'Step' appears if you choose the menu item 'Object Properties...' in the context menu of
the step. It is used to change the properties of the step.
3
General information about editing in SFC Inserting jumps while editing SFC
Jumps are steps with successors in other worksheets in this POU or with successors somewhere
else in the same worksheet. The name of the jump represents its target where to go to.
How to proceed:
• Press the button 'Change' to delete all unnecessary objects and to insert the jump.
The dialog 'Jump/End step insert control' appears if you have called the dialog 'Step' for a step and
the type of the step is changed into a jump or an end step. In those cases some other elements of
your loop normally have to be deleted. Using this dialog you can have a look at the elements to be
deleted or delete them directly.
Show marked objects for delete marks all objects that have to be deleted to insert the jump or the
end step.
Change deletes immediately all necessary objects to insert a jump or an
end step. Only available if you have activated the checkbox
'show marked objects for delete'.
OK shows the objects to be deleted if you have activated the
checkbox 'show marked objects for delete'.
Closes the dialog if you have not activated the checkbox 'show
marked objects for delete'.
If you want to see the objects that have to be deleted first, then:
4
General information about editing in SFC Inserting end steps
How to proceed:
• Press the button 'Change' to delete all unnecessary objects and insert the end step.
If you have changed a step of an SFC network into an end step you can use the SFC branch edit
mode to reconnect the end step. To perform this, click on the icon 'Insert SFC branch' in the toolbar
and reconnect the end step.
How to proceed:
5
General information about editing in SFC Associating a new inserted action detail to a step
How to proceed:
• Mark the step you want to associate the new action detail.
• In the field 'Name' enter the name of your new action detail worksheet.
If you have checked the menu item 'Fixed SFC objects width' in the submenu 'Layout' the width of
steps and actions is always the same. If not the width is adjusted according to the length of the
name of the step or action.
How to proceed:
You can change the type only if the transition is not connected to a variable or an FBD object. If it is
directly connected to a variable you have to delete either the variable or the connecting line first.
How to proceed:
6
General information about editing in SFC Dialog 'Transition'
• Click the right mouse button to display the context menu and choose the menu item
'Object Properties...'.
The dialog 'Transition' appears.
Dialog 'Transition'
The dialog 'Transition' appears if you choose the menu item 'Object Properties...' in the context
menu of a transition. It is used to change the properties of the transition.
Name specifies the name of the transition. Only available if the transition is a detail.
Type specifies if the transition is a detail or a direct connection.
Transitions can be details or direct connections. Detail means that the transition has an own code
body. In the case of a detail you can see or edit the code body by double clicking on the transition.
The corresponding worksheet is called.
Direct connection means that there is no code body and the transition is directly connected to a
variable, LD or an FBD network. In the case of a direct connection the transition should not have a
name.
If you have checked the menu item 'Fixed SFC objects width' in the submenu 'Layout' the width of
steps and actions is always the same. If not the width is adjusted according to the length of the
name of the step or action.
How to proceed:
• Right click on the action block and select the context menu item 'Object Properties...'.
The dialog 'Action Properties' appears.
If you are calling a code body of a detail for the first time the dialog 'Insert' appears. In this case
choose the programming language and confirm the dialog. The worksheet is inserted in the project
tree and is opened for immediate editing.
7
General information about editing in SFC Inserting branches using the icon 'Insert branch'
How to proceed:
If you want to enlarge the simultaneous branch or to connect it to a different place of the SFC
network it is possible to change the last step of the branch into an end step and reconnect the
branch using the SFC branch edit mode. Therefore call first the dialog 'Step' for changing the step
and click on the icon 'Insert SFC branch' in the toolbar:
8
General information about editing in SFC Inserting branches using the icon 'Insert branch'
The following figure shows a part of SFC network with an alternative and a simultaneous branch:
9
General information about editing in SFC Dialog 'Divergence'
Dialog 'Divergence'
The dialog 'Divergence' appears if you mark a transition or a step in your worksheet and click on
the icon 'Insert Simultaneous/Alternative Branches' in the toolbar.
The dialog field 'Branches Count' specifies the number of branches to be inserted.
While using the SFC branch edit mode always click in the object and not on a line.
10
General information about editing in SFC Inserting variables for actions in SFC
A symbol for an SFC branch is added to the shape of the cursor. During the SFC branch
edit mode, the icon appears 'pressed'.
• Move the cursor to a free position where you want to drop the transition symbol. Avoid
collisions with other symbols.
• Move the cursor to the transition where you want to close the branch.
The SFC branch edit mode is terminated automatically, after the new branch is inserted. For
inserting another branch, reselect the SFC branch edit mode by clicking on the icon again.
A symbol for an SFC branch is added to the shape of the cursor. During the SFC branch
edit mode, the icon appears 'pressed'.
• Move the cursor to the position where you want to drop the symbol. Avoid collisions with
other symbols.
• Move the cursor to the step where you want to close the branch.
The SFC branch edit mode is terminated automatically, after the new branch is inserted. For
inserting another branch, reselect the SFC branch edit mode by clicking on the icon again.
• Inserting variables which have already been declared in the variable worksheet
• Inserting variables which have not been declared in the variable worksheet before
In the following figure you can see an action block with the variable name 'var2':
11
General information about editing in SFC How to insert a variable for an action...
How to insert a variable for an action which has been declared before
• Click on the action with the right mouse button to open the context menu.
• On the dialog page 'Action' of the dialog 'Action Properties' activate the radio button 'Local
Scope' if you want to insert a local variable. Activate 'Global Scope' if you want to insert a
global variable.
Depending on the selected scope, the variables list box below the field 'Name' now
contains all local or global variables which are declared in the corresponding local or
global variables worksheet. It does not matter in which group a variable is declared, the
list box shows the content of all groups in the variables worksheet.
• Click on the desired variable in the variables list box. The marked name is entered into the
text field.
• Click on the action with the right mouse button to open the context menu.
12
General information about editing in SFC Changing variables for actions in SFC
• On the page 'Action' enter the new name in the field 'Name' and click on the button 'Apply'.
The dialog page 'Common' is opened automatically.
• On the dialog page 'Common' select the appropriate settings for the variable and click on
'Apply' to confirm the settings.
Note: By selecting the usage, you define, whether you are declaring a local or a global
variable.
• Now you have to define the scope of the new variable, i.e. the variables group into which
the new declaration should be inserted. For that purpose open the dialog page 'Local
scope' if you are declaring a local variable or 'Global scope' in the case of a global
variable.
In the subtree on the dialog page browse for the variables group into which you want to
insert the new variable declaration and mark it with a left mouse click.
Note: If you are declaring a global variable (i.e. usage VAR_EXTERNAL or
VAR_EXTERNAL_PG), you have to select both, a local and a global scope.
The autoinsertion of the variable declaration is not done if the variable has the same name as the
POU, an action or transition code body or if it is a structure or an array.
If the variables grid worksheet is opened while declaring a new variable in the code body
worksheet, the grid is updated (i.e. the new declaration is inserted into the specified variables
group) automatically without closing the variables worksheet.
It is possible to change the variable into a variable which has been declared before in the variable
worksheet. It is also possible to enter a name for a new variable and thus declare a new variable
while changing.
How to proceed:
• For replacing the current variable by an already declared variable, select the desired
variable in the variables list box on the dialog page 'Action'. If required mark the radio
button 'Local scope' or 'Global scope'. Proceed as described in the topic How to insert a
variable for an action which is already declared.
13
General information about editing in SFC Inserting variables for transitions in SFC
For replacing the current variable by a new variable, enter a new name and then
proceed as described in the topic How to insert and declare a new variable for an action.
For changing the properties of the current variable open the dialog page 'Common' and
do the required changes.
• Inserting variables which have been already declared in the variable worksheet
• Inserting variables which have not been declared in the variable worksheet before
It is also possible to insert variables somewhere in the editing field and then to connect them to the
transitions being direct connections using the connection mode. This method is described in the
topic Inserting variables while editing FBD.
How to insert a variable for a transition which has been declared before
• Click on the transition with the right mouse button to open the context menu.
14
General information about editing in SFC How to declare and insert a new variable for a transition
• On the page 'Variables' of the dialog 'Variable Properties' activate the radio button 'Local
Scope' if you want to insert a local variable. Activate 'Global Scope' if you want to insert a
global variable.
Depending on the selected scope, the variables list box below the field 'Name' now
contains all local or global variables which are declared in the corresponding local or
global variables worksheet. It does not matter in which group a variable is declared, the
list box shows the content of all groups in the variables worksheet.
• Click on the desired variable in the variables list box. The marked name is entered into the
text field.
Example:
• Click on the transition with the right mouse button to open the context menu.
15
General information about editing in SFC How to declare and insert a new variable for a transition
• On the page 'Variables' of the dialog 'Variables Properties' enter the new name in the field
'Name' and click on the button 'Apply'. The dialog page 'Common' is opened automatically.
• On the dialog page 'Common' select the appropriate settings for the variable and click on
'Apply' to confirm the settings.
Note: By selecting the usage, you define, whether you are declaring a local or a global
variable.
• Now you have to define the scope of the new variable, i.e. the variables group into which
the new declaration should be inserted. For that purpose open the dialog page 'Local
scope' if you are declaring a local variable or 'Global scope' in the case of a global
variable.
In the subtree on the dialog page browse for the variables group into which you want to
insert the new variable declaration and mark it with a left mouse click.
Note: If you are declaring a global variable (i.e. usage VAR_EXTERNAL or
VAR_EXTERNAL_PG), you have to select both, a local and a global scope.
Example:
16
General information about editing in SFC Changing variables for transitions in SFC
The autoinsertion of the variable declaration is not done if the variable has the same name as the
POU, an action or transition code body or if it is a structure or an array.
If the variables grid worksheet is opened while declaring a new variable in the code body
worksheet, the grid is updated (i.e. the new declaration is inserted into the specified variables
group) automatically without closing the variables worksheet.
It is possible to change the variable into a variable which has been declared before in the variable
worksheet. It is also possible to enter a name for a new variable and thus declare a new variable
while changing.
How to proceed:
• For replacing the current variable by an already declared variable, select the desired
variable in the variables list box on the dialog page 'Variables'. If required mark the radio
button 'Local scope' or 'Global scope'. Proceed as described in the topic How to insert a
variable for a transition which is already declared.
For replacing the current variable by a new variable, enter a new name and then
proceed as described in the topic How to insert and declare a new variable for a transition.
For changing the properties of the current variable open the dialog page 'Common' and
do the required changes.
17
General information about editing in SFC Calling functions and inserting contacts/coils in SFC
The steps how to insert and connect functions using the Edit Wizard are described in the topics
Inserting functions in the graphic editor using the Edit Wizard and Connecting objects in the
graphic editor.
It is also possible to insert LD networks and connect them to the transition. The steps how to insert
contacts and coils are described in the topic General information about editing in LD.
How to proceed:
• Choose the menu item 'Optimize SFC Lines' in the submenu 'Edit > Stretch/Compress'.
The lines are optimized automatically.
18