0% found this document useful (0 votes)
12 views14 pages

FBD Editor

This document provides information about editing functions and function blocks (FBs/FUs) in Function Block Diagram (FBD) programming in three main ways: 1) Inserting and changing properties of FBs/FUs using the Edit Wizard and FB/FU Properties dialog. 2) Replacing individual or multiple FBs/FUs of the same type. 3) Inserting, changing, and connecting variables in FBD.

Uploaded by

Tuấn Lê Quang
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views14 pages

FBD Editor

This document provides information about editing functions and function blocks (FBs/FUs) in Function Block Diagram (FBD) programming in three main ways: 1) Inserting and changing properties of FBs/FUs using the Edit Wizard and FB/FU Properties dialog. 2) Replacing individual or multiple FBs/FUs of the same type. 3) Inserting, changing, and connecting variables in FBD.

Uploaded by

Tuấn Lê Quang
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

FBD Editor

FBD Editor
General information about editing in FBD.....................................................................................1
Inserting functions or function blocks in the graphic editor using the Edit Wizard................1
Changing the properties of functions and function blocks....................................................3
Replacing functions or function blocks.................................................................................3
How to replace one function or function block using the Edit Wizard....................3
How to replace several functions or function blocks of one type...........................4
Dialog 'Local Replace FB/FU'................................................................................4
Inserting variables while editing FBD...................................................................................4
How to insert a variable in FBD which has been declared before.........................4
How to declare and insert a new variable in FBD..................................................5
Changing variables while editing FBD..................................................................................6
Negation of inputs and outputs of functions and function blocks.........................................7
Duplicating inputs of functions..............................................................................................7
Deleting inputs of functions..................................................................................................8
Inserting connectors while editing FBD................................................................................8
Inserting jumps and labels while editing FBD.......................................................................9
Inserting returns while editing FBD....................................................................................10
Changing the flag type using the dialog 'Flag Type Properties'.........................................10
Viewing the execution order of functions and function blocks............................................10
Viewing feedbacks in FBD networks..................................................................................11
Source conversion for IL, FBD and LD...............................................................................11

i
General information about editing in FBD
In the graphic editor you can edit in the programming language FBD using different features of the
program.

In order to edit an FBD code body worksheet you first have to open the corresponding worksheet in
the project tree by double clicking on the desired icon.

The graphical programming language FBD provides many additional features, which facilitate the
creation of a program, FB or function code body, e.g.:

• Functions and function blocks can be inserted using the Edit Wizard and edited using the
dialog 'Variables Properties'.

• The graphic editor provides simple keyboard operations for insertion and scrolling (Cursor
keys /CTRL Cursor keys for object mode and SHIFT/SHIFT CTRL Cursor keys for mouse
cursor mode).

• Duplication of inputs can be done directly via keyboard, toolbar and menu.

• Negation of Inputs, Outputs, Contacts and Coils can be done directly via keyboard, toolbar
and menu.

• Easy auto routing for standard editing cases.

• Items can be inserted directly on a line or can be connected to the inputs or outputs of
present items.

• Splitter and overview windows are available.

• Freestyle editing allows to arrange items wherever you want.

• Double clicking on user functions and function blocks opens the contents of the
corresponding POU.

Inserting functions or function blocks in the graphic editor


using the Edit Wizard
The method of inserting either a function or a function block is the same.

The most comfortable way to perform this is to use the Edit Wizard.

If you have inserted a new function or function block POU and you want to use it in a worksheet,
compile the variables worksheet of the new POU with 'Compile Worksheet'. You can insert the new
element immediately in your new worksheet having done this compilation.

1
General information about editing in FBD General information about editing in FBD

The command 'Compile Worksheet' of the submenu 'Build' can be used to compile only one
worksheet for detecting syntax errors while developing a project. It is only available if the worksheet
is the active window. Using Compile Worksheet no code is generated.

How to proceed:

• If the Edit Wizard is not visible, click on the icon 'Edit Wizard' in the toolbar.

The Edit Wizard is activated by clicking in the Edit Wizard or pressing <ALT> + <3>.

• Locate the code body position in your worksheet, where the new function or function block
has to be inserted.

• If desired activate the grid by selecting the menu item 'Grid' in the submenu 'Layout'.

• Place the insertion mark at this position.

• Open the Edit Wizard list box 'Group' and select the desired group of functions or function
blocks.

• Determine the desired function or function block in the Edit Wizard selection area.

• Double click on the desired function or function block.


A function will be inserted directly into the worksheet.
If you are inserting a function block, the dialog 'Variables Properties' appears. In this case
continue with the next item of this procedure.

• In the dialog 'Variables Properties' an instance name for the inserted FB is proposed in the
field 'Name' on the dialog page 'Variables'.
The field 'Name' displays the default instance name (e.g. for a CTU the name 'CTU_n' is
proposed, where n is the first available number which is free for this instance name).
To define the name of the new FB you have the following possibilities:
* Enter a new instance name in the field.
* Accept the proposed name.
* Select an already existing name in the instance name list box below the text field.

• If desired enter a comment concerning the new function block on the dialog tab 'Common'.

• On the tab 'Local Scope' of the dialog 'Variables Properties' mark the group of the local
variables grid worksheet into which you want to insert the new instance declaration. For
that purpose click on the desired group name with the left mouse button.

• Confirm the dialog 'Variables Properties'.


The new function block is inserted automatically in the graphical worksheet. Its declaration
is autoinserted into the group of the local variables worksheet, which you have selected on
the page 'Local Scope' of the properties dialog.

Due to the enhanced object management in graphical worksheets, a possible collision


between the new inserted object and already existing objects is corrected automatically.
Further information about collision detection and collision delay time is provided in the
topic Settings for the graphic editor.

2
General information about editing in FBD Changing the properties of functions and function blocks

By using different colors for functions and function blocks the origin of the related object is
indicated. IEC FIRMWARE FUs/FBs and FUs/FBs from FIRMWARE libraries are displayed in red.
USER FUs/FBs from the same project are displayed in green and USER FUs/FBs from an user
library are displayed in blue.
Please note, that the colors described above are system default colors. If you have changed the
colors using the dialog 'Options', your display may differ from the help information.

Changing the properties of functions and function blocks


You can change the properties of any function or function block inserted into the FBD worksheet by
calling the dialog 'FB/FU Properties'.

How to proceed:

• In the FBD worksheet click with the right mouse button on the function or function block to
be edited to open the context menu for this object.

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


The dialog 'FB/FU Properties' appears. When calling the dialog for a function only the
dialog tab 'FB/FU' is provided, showing the formal parameters. In case of a function block,
the dialog 'FB/FU Properties' is divided into four tabs.

• Change the desired properties.

• Confirm the dialog.


If you have changed the instance name of a function block, the new declaration of the
function block instance is autoinserted into the variables group which has been selected in
the dialog tab 'Local scope'.

Replacing functions or function blocks


Having inserted functions or function blocks it might be necessary to replace them by a different
function or function block. For replacing functions and function blocks you have two possibilities:

• Replacing one function or function block using the Edit Wizard

• Replacing several functions or function blocks of one type within the worksheet

Functions and function blocks can be replaced maintaining the connection lines if they have the
same formal parameters. If not, the lines will be deleted.

How to replace one function or function block using the Edit Wizard

• Click on the function or function block you want to replace. The marked object changes its
color.

• In the Edit Wizard choose the desired function or function block.

• Double click on the function or function block.

3
General information about editing in FBD How to replace several functions or function blocks of one type

How to replace several functions or function blocks of one type

• Choose the menu item 'Replace FB/FU' in the submenu 'Edit'.


The dialog 'Local Replace FB/FU' appears.

• Choose the function or function block type to search for.

• Choose the function or function block for replacing.

• Press the button 'Find Next' to go to the first function or function block to be replaced.

• Press the button 'Replace all' if you want to replace all functions or function blocks of this
type without having a look at them.

• Press the button 'Replace' if you want to replace them step by step.

Dialog 'Local Replace FB/FU'

The dialog 'Local Replace FB/FU' appears if you choose the menu item 'Replace FB/FU' in the
submenu 'Edit'. It can be used to replace functions and function blocks.

The dialog fields and buttons have the following meaning:

Find What specifies the function or function block to search for.


Replace With specifies the new function or function block.
Find Next goes to the first match of the function or function block.
Replace replaces the first match. Only available if you have used the button 'Find Next'
and a function or function block is marked.
Replace All replaces all matches.

Inserting variables while editing FBD


There are 2 possibilities to insert variables:

• Inserting variables which have already been declared in the variables grid worksheet

• Inserting variables which have not been declared in the variables grid worksheet before

Variables can be inserted anywhere in the FBD worksheet or directly connected to an input/output
(formal parameter) of functions or function blocks.

How to insert a variable in FBD which has been declared before

• If you want to insert a variable not connected to a function or function block, click in the
worksheet to set an insertion mark.

If you want to insert a variable already connected to a function or function block, mark the
formal parameter of the object.

4
General information about editing in FBD How to declare and insert a new variable in FBD

Example:

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

How to declare and insert a new variable in FBD

• If you want to insert a variable not connected to a function or function block, click in the
worksheet to set an insertion mark.

If you want to insert a variable already connected to a function or function block, mark the
formal parameter of the object.
Example:

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

5
General information about editing in FBD Changing variables while editing FBD

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 while editing FBD


You can change variables if you have connected a wrong variable to an input or an output.

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.


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 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 changing the properties of the current variable open the dialog page 'Common' and
do the required changes.

6
General information about editing in FBD Negation of inputs and outputs of functions and function blocks

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

Negation of inputs and outputs of functions and function blocks


Using the graphic editor, it is easy to negate and to toggle the negation of inputs or outputs of
functions and function blocks.

To negate an FP (Formal Parameter) you can either perform the procedure described below or you
can use the dialog 'FB/FU Properties' which is called by double clicking on the function or function
block.

How to proceed:

• Click on the input or output you want to negate. The marked FP changes its color.
Example:

• Click on the icon 'Toggle negation of FP' in the toolbar.

The input or output is shown with a circle as negation symbol.


To toggle the negation, just perform the described steps again for the same input or
output.
Example:

Duplicating inputs of functions


You can duplicate only inputs of extensible functions. Duplicating inputs of other functions is not
possible.

It is only possible to duplicate the last input of the function.

To duplicate function inputs you can either perform the procedure described below or you can use
the dialog 'FB/FU Properties' which is called by double clicking on the function.

How to proceed:

• Click on the last input of the function you want to duplicate. The marked input changes its
color.
Example:

7
General information about editing in FBD Deleting inputs of functions

• Click on the icon 'Duplicate FP' in the toolbar.

The new input is added below the previously selected input.

It is also possible to delete inputs of extensible functions which have been duplicated before.

Deleting inputs of functions


You can delete only inputs of extensible functions which have been duplicated before. Deleting
inputs of other functions is not possible.

To delete inputs of functions you can either perform the procedure described below or you can use
the dialog 'FB/FU Properties' which is called by double clicking on the function.

How to proceed:

• Click on the duplicated input of the function you want to delete.

• Press <DEL>.

Inserting connectors while editing FBD


You can insert connectors instead of connection lines if you have long distances between objects.
When executing the program it goes automatically from the output connector to the input connector
with the same name. It is possible to have one output connector and several input connectors with
the same name.

Connectors can only be used within one worksheet.

How to proceed:

• Mark the input or output of an object in your worksheet where you want to insert the
connector.

• Click on the icon 'Connector/Jump or Label' in the toolbar.

The dialog 'Connector/Jump' appears.

8
General information about editing in FBD Inserting jumps and labels while editing FBD

• Enter a name for the connector.

• Activate the radio button 'Connector'.

• Confirm the dialog.


The connector is inserted connected to the marked object.

It is also possible to insert a connector somewhere in the worksheet by setting an insertion mark
and then clicking on the icon 'Connector/Jump or Label' in the toolbar.

Inserting jumps and labels while editing FBD


While editing FBD jumps can be used. For realizing jumps two objects have to be inserted in your
worksheet: a jump and a label. The label is the target for the jump. Jump and label must have the
same name.

How to insert a jump:

• Mark the output of an object in your worksheet where you want to insert the jump.

• Click on the icon 'Connector/Jump or Label' in the toolbar.

The dialog 'Connector/Jump' appears.

• Enter a name for the jump.

• Activate the radio button 'Jump'.

• Confirm the dialog.


The jump is inserted connected to the marked object.

It is also possible to insert a jump somewhere in the worksheet by setting an insertion mark and
then clicking on the icon 'Connector/Jump or Label' in the toolbar.

How to insert a label:

• Click in the worksheet to set an insertion mark where you want to insert the label.

• Click on the icon 'Connector/Jump or Label' in the toolbar.

The dialog 'Connector/Jump' appears.

• Activate the radio button 'Label'.

• Enter a name for the label. The label name must be identical with the name of the related
jump.

• Confirm the dialog.


The label is inserted.

9
General information about editing in FBD Inserting returns while editing FBD

Inserting returns while editing FBD


In FBD worksheets returns can be inserted for returning back to the calling POU if the Boolean
variable is TRUE. If the variable is FALSE the execution of the current network continues.

How to proceed:

• Mark the output of an object in your worksheet where you want to insert the return.

• Click on the icon 'Return' in the toolbar to insert a Return.

It is also possible to insert a return somewhere in the worksheet by setting an insertion mark and
then double clicking on the icon 'Return' in the toolbar.

Changing the flag type using the dialog 'Flag Type Properties'
If functions are connected directly with each other by a line (i.e. a direct line from connection point
to connection point) the program sometimes needs an internal temporary flag for compilation.

In those cases where the data type of an internal flag is not determined by the structure of the
network you have do it manually by using the dialog 'Flag Type Properties'. This dialog only
contains a list box for specifying the data type of the current flag.

Normally you will get a compilation error in the message window. Double clicking on the error
message will go directly to the point where the flag is needed.

How to proceed:

• Double click on a line or choose the menu item 'Object Properties...' in the context menu
of a line used to connect functions.
The dialog 'Flag Type Properties' appears.

• Change the data type of the flag and confirm the dialog 'Flag Type Properties'.

Viewing the execution order of functions and function blocks


You can view the order of execution of the different functions or function blocks in your worksheet.

The execution order corresponds to the intermediate PLC code which is created while compiling. It
may differ from the execution order of the PLC.

The execution order can only be seen if you have already compiled the worksheet using the menu
item 'Compile Worksheet' in the submenu 'Build'.
This command can be used to compile only one worksheet for detecting syntax errors while
developing a project. It is only available if the worksheet is the active window. Using Compile
Worksheet no code is generated.
Using the menu item 'Compile Worksheet' you cannot detect programming errors such as using a
variable in a code body which has not been declared in a variable declaration. In those cases you
should use the menu item 'Make' or the menu item 'Rebuild Project'.

10
General information about editing in FBD Viewing feedbacks in FBD networks

How to proceed:

• If the worksheet is not already compiled, choose the menu item 'Compile Worksheet' in
the submenu 'Build' or click on the icon 'Compile Worksheet' in the toolbar to compile the
worksheet.

• Choose the menu item 'Execution Order' in the submenu 'Layout'.


In the middle of the function or function block the execution number is shown.

Viewing feedbacks in FBD networks


While editing in FBD feedbacks could result. If an FBD object with a higher execution number is
connected to an object with a lower execution number it is called feedback. To check these
feedbacks you have the possibility to view the feedbacks.

The execution order corresponds to the intermediate PLC code which is created while compiling. It
may differ from the execution order and feedbacks of the PLC.

Feedbacks can only be seen if you have already compiled the worksheet using the menu item
'Compile worksheet' in the submenu 'Build'.
This command can be used to compile only one worksheet for detecting syntax errors while
developing a project. It is only available if the worksheet is the active window. Using Compile
Worksheet no code is generated.
Using the menu item 'Compile Worksheet' you cannot detect programming errors such as using a
variable in a code body which has not been declared in a variable declaration. In those cases you
should use the menu item 'Make' or the menu item 'Rebuild Project'.

How to proceed:

• If the worksheet is not already compiled, choose the menu item 'Compile Worksheet' in
the submenu 'Build' or click on the icon 'Compile Worksheet' in the toolbar to compile the
worksheet.

• Choose the menu item 'Highlight Feedback' in the submenu 'Layout'.


A feedback is represented with a red line.

Feedbacks are represented with green lines if you have done changes in your worksheet since last
compilation. In those cases compile the worksheet using 'Compile Worksheet'.

Source conversion for IL, FBD and LD


Additionally to the requirements given by IEC 1131−3, your programming system provides a
powerful feature which is called 'Source conversion'. It can be used to cross compile an existing
POU which is written in one of the languages IL, FBD or LD into each of the other two languages.

The following table shows the possible source conversions:

Source language possible target languages

11
General information about editing in FBD Viewing feedbacks in FBD networks

IL FBD, LD
FBD IL, LD
LD IL, FBD

Prerequisite for each source conversion is that the project which contains the POU to be
converted was already built before (using one of the commands 'Make' or 'Rebuild Project' in the
submenu 'Build'). This is necessary, because the system does not convert the textual or graphical
language elements which are visible in the corresponding worksheets, but the intermediate code,
generated while compiling the project.

How to proceed:

• Make sure, that the project was already built before.

• In the project tree open the subtree 'Logical POUs' and mark the folder icon of the POU to
be converted.
Example:

• Click with the right mouse button on the icon in order to open its context menu.

• Select the menu item 'Source conversion'.


The dialog 'Source conversion' appears.

• In the dialog mark the checkbox 'Overwrite source POU' if desired, determine the name of
the target POU and mark the desired target language (please refer to the table shown
below).

• Confirm the dialog.


According to your settings the source POU is converted and the new POU is inserted in
the project tree.

• Note, that the new POU is not yet compiled after the conversion.

The dialog fields have the following meaning:

Overwrite source POU if this checkbox is marked, the source POU is going to be overwritten
by the converted POU. Otherwise the source POU is not changed
and is available for future use.

Text field this field is used to define a name for the new POU. After opening the
dialog, the system automatically proposes a name. You can either
leave this name unchanged or enter a new name.

Convert to these radio buttons are used to determine the target language. Of
'FBD', 'LD', 'IL' course the source language is displayed in grey.

12

You might also like