Anda di halaman 1dari 20

SFC editor

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.

Actions and transition details


It is possible to edit a code body for actions and transitions. These actions and transitions have
their own code body which are located in the project tree below the directory nodes for actions and
transitions. It is called detail.

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.

How to create an action or transition detail:

• Double click on the action or transition in the SFC worksheet.


The dialog 'Insert' appears.

• Choose the programming language for the detail.

• Confirm the dialog.


The action or transition worksheet is inserted in the project tree and the worksheet is
opened.

• Edit your action and transition worksheet.

Inserting a first SFC network, steps and transitions


You can insert either a new SFC network with one step and a transition or steps and transitions in
an existing network.

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.

How to insert a new SFC network:

• Click into the worksheet to set an insertion mark.

• Click on the icon 'Insert step transition sequence' in the toolbar.

A SFC network with one step and one transition is inserted.

The following figure shows an SFC network with one initial step (S001), the corresponding action
block (A001) and one transition (T001).

How to insert steps and transitions in existing networks:

• Click on the step, the new transition and step will succeed.

• Click on the icon 'Insert step transition sequence'.

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

Changing a normal step into an initial step and vice versa


In every SFC network you should have one initial step which is the first step to be executed when
the POU is called. The first step which you have inserted is automatically an initial step. If
necessary you can change this initial step into a normal step and change the properties of a normal
step into an initial step. Furthermore you can change an existing step.

How to proceed:

• Double click on the step you want to change.


The dialog 'Step' appears.

• 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.

The dialog fields and buttons have the following meaning:

Name specifies the name of the step or the jump.


Type specifies the type of the step or the jump.

3
General information about editing in SFC Inserting jumps while editing SFC

Inserting jumps while editing SFC


You can insert jumps in existing SFC networks.

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.

It is not possible to insert a jump in a simultaneous branch.

How to proceed:

• Insert a step and a transition.

• Double click on the step.


The dialog 'Step' appears.

• Activate the checkbox 'Jump'.

• Confirm the dialog.


The dialog 'Jump/End step insert control' appears.

• Press the button 'Change' to delete all unnecessary objects and to insert the jump.

• Press the button 'OK' to show all unnecessary objects.

Dialog 'Jump/End step insert control'

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.

The dialog fields and buttons have the following meaning:

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'.

How to work with the dialog

If you want to see the objects that have to be deleted first, then:

• Activate the checkbox 'show marked objects for delete'.

4
General information about editing in SFC Inserting end steps

• Press the button 'OK'.


All objects to be deleted are marked. Call the dialog once more, if you want to delete
these objects.

If you want to delete directly the objects, then:

• Activate the box 'show marked objects for delete'.

• Press the button 'Change'.


The objects are deleted and the jump or the end step is inserted.

Inserting end steps


You can insert end steps if you want to finish the closed SFC network to go back to the calling
POU.

How to proceed:

• Click on the step you want to be the end step.


The dialog 'Step' appears.

• Activate the checkbox 'End step'.

• Confirm the dialog.


The dialog 'Jump/End step insert control' appears.

• Press the button 'Change' to delete all unnecessary objects and insert the end step.

• Press the button 'OK' to show all unnecessary objects.

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.

Inserting action blocks


You can insert new action blocks if you have deleted them or you can add new action blocks to an
existing one to create a concatenated action block in your SFC worksheet. Concatenated action
blocks are several action blocks associated to one step.

How to proceed:

• Mark the step if you want to insert a new action block.


Mark the existing action block if you want to have a concatenated action block.

• Click on the icon 'Create action' in the toolbar.

The dialog 'Action Properties' appears.

5
General information about editing in SFC Associating a new inserted action detail to a step

• Enter a new name for the action if you want.

• Do more entries if necessary.

Associating a new inserted action detail to a step


If you have created a new action detail worksheet, you can associate this worksheet to a step in
your SFC network.

How to proceed:

• Mark the step you want to associate the new action detail.

• Click on the icon 'Create action' in the toolbar.

The dialog 'Action Properties' appears.

• In the field 'Name' enter the name of your new action detail worksheet.

• Activate the radio button 'Detail'.

• Confirm the dialog.


The new action is associated to the step displaying the name of the action detail
worksheet.

Changing the properties of a step


You can change the properties of a step such as the name or the type.

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:

• Double click on the step.


The dialog 'Step' appears.

• Change the name and the associated type of the step.

Changing the properties of a transition


You can change the properties of a transition such as the name or the type.

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 on the transition to mark it.

• Click the right mouse button to display the context menu and choose the menu item
'Object Properties...'.
The dialog 'Transition' appears.

• Change the name and the associated type of the transition.

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.

The dialog fields and buttons have the following meaning:

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.

Changing the properties of an action block


You can change the properties of an action block, such as changing the name or the action
qualifier.

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.

• Change the entries you want to.

Calling a code body of a transition or an action


If the action or the transition is a detail and has its own code body, you can call the code body
declaration from your SFC worksheet.

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:

• Double click on the transition or the action block.


The worksheet with the code body declaration is opened.

Inserting branches using the icon 'Insert branch'


You can insert either alternative or simultaneous branches in an SFC network.

How to insert an alternative branch:

• Mark the step where you want to insert the branch.

• Click on the icon 'Insert Simultaneous/Alternative Branches' in the toolbar.

The dialog 'Divergence' appears.

• Enter the number of branches you want to insert.

How to insert a simultaneous branch:

• Mark the transition where you want to insert the branch.

• Click on the icon 'Insert Simultaneous/Alternative Branches' in the toolbar.

The dialog 'Divergence' appears.

• Enter the number of branches you want to insert.

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:

Example figures for alternative and simultaneous branches

The following figure shows an SFC network with 2 alternative branches:

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.

A maximum of 32 branches can be inserted.

Inserting branches using the SFC branch edit mode


You can insert branches using the SFC branch edit mode. The SFC branch edit mode is a
comfortable tool used to insert branches. It can be used either for simultaneous or for alternative
branches.

While using the SFC branch edit mode always click in the object and not on a line.

How to insert a simultaneous branch:

• Click on the icon 'Insert SFC branch' in the toolbar.

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'.

• Click in the upper half of a step.

• Move the cursor to a free position where you want to drop the transition symbol. Avoid
collisions with other symbols.

• Click the left mouse button to drop the branch.

• Move the cursor to the transition where you want to close the branch.

• Click the left mouse button at this point to finish it.

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.

How to insert an alternative branch:

• Click on the icon 'Insert SFC branch' in the toolbar.

A symbol for an SFC branch is added to the shape of the cursor. During the SFC branch
edit mode, the icon appears 'pressed'.

• Click in the lower half of a step.

• Move the cursor to the position where you want to drop the symbol. Avoid collisions with
other symbols.

• Click the left mouse button to drop the branch.

• Move the cursor to the step where you want to close the branch.

• Click the left mouse button at this point to finish it.

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 for actions in SFC


In an SFC worksheet actions can be Boolean variables. The variable is represented by the name of
the action.

There are 2 possibilities to insert variables:

• 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.

• Choose the menu item 'Object Properties...'.


The dialog 'Action Properties' appears.

• On the dialog page 'Action' activate the radio button 'Variable'.

• 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.

• Confirm the dialog.


The variable is inserted in the graphical worksheet.

How to declare and insert a new variable for an action

• Click on the action with the right mouse button to open the context menu.

• Choose the menu item 'Object Properties...'.


The dialog 'Action Properties' appears.

• On the dialog page 'Action' activate the radio button 'Variable'.

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.

• After selecting the scope, click on 'OK'.


The variable is inserted into the code body worksheet and its declaration is automatically
inserted into the selected group of the corresponding variables grid worksheet.
In the case of a global variable, the declaration is inserted into the local variables grid
using the keyword 'VAR_EXTERNAL' and into the global variables worksheet using
'VAR_GLOBAL'.

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.

Changing variables for actions in SFC


You can change variables for actions if you have selected a wrong variable or other properties are
required.

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:

• Double click on the action to be changed.


The dialog 'Action Properties' appears.

• 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.

• Confirm the dialog 'Action Properties' with 'OK'.

Inserting variables for transitions in SFC


In case of transitions you can insert either a variable already connected to the transition or you can
insert the variable somewhere in the worksheet. This variable can be connected via the connection
mode to the connection point of the transition.

There are 2 possibilities to insert variables:

• 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.

• Choose the menu item 'Object Properties...'.


The dialog 'Transition' appears.

• Activate the radio button 'Direct connection'.

• Confirm the dialog.


The transition is shown with a green connection point.
Example:

• Mark the transition.

14
General information about editing in SFC How to declare and insert a new variable for a transition

• Click on the icon 'Variable' in the toolbar.

The dialog 'Variable Properties' appears.

• 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.

• Confirm the dialog.


The variable is inserted in the graphical worksheet at the transition.

Example:

How to declare and insert a new variable for a transition

• Click on the transition with the right mouse button to open the context menu.

• Choose the menu item 'Object Properties...'.


The dialog 'Transition' appears.

• Activate the radio button 'Direct connection'.

• Confirm the dialog.


The transition is shown with a green connection point.
Example:

15
General information about editing in SFC How to declare and insert a new variable for a transition

• Mark the transition.

• Click on the icon 'Variable' in the toolbar.

The dialog 'Variable Properties' appears.

• 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.

• After selecting the scope, click on 'OK'.


The variable is inserted into the code body worksheet at the transition and its declaration
is automatically inserted into the selected group of the corresponding variables grid
worksheet.
In the case of a global variable, the declaration is inserted into the local variables grid
using the keyword 'VAR_EXTERNAL' and into the global variables worksheet using
'VAR_GLOBAL'.

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.

Changing variables for transitions in SFC


You can change variables for transitions if you have selected a wrong variable or other properties
are required.

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:

• Double click on the variable to be changed.


Example:

The dialog 'Variable Properties' appears.

• 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.

• Confirm the dialog 'Variable Properties' with 'OK'.

17
General information about editing in SFC Calling functions and inserting contacts/coils in SFC

Calling functions and inserting contacts/coils in SFC


Instead of variables as it has been described in the preceeding topic also functions can be
connected to transitions with direct connections. In these cases you first have to insert the function
and then connect it with the connection point of the transition.

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.

Optimizing SFC lines after deleting


If you delete more than one step and one transition, such as whole branches, sometimes the lines
which remain are very long. In those cases it is possible to optimize the length of these lines
automatically.

How to proceed:

• Mark the part whose lines should be optimized.

• Choose the menu item 'Optimize SFC Lines' in the submenu 'Edit > Stretch/Compress'.
The lines are optimized automatically.

18

Anda mungkin juga menyukai