Sie sind auf Seite 1von 26

System 800xA Training

Chapter 9 Function Block Diagram

TABLE OF CONTENTS
Chapter 9 Function Block Diagram .........................................................................................................................................1
9.1 General Information ......................................................................................................................................................2
9.1.1 Objectives ..............................................................................................................................................................2
9.1.2 Legend ...................................................................................................................................................................2
9.1.3 Reference Documentation .......................................................................................................................................2
9.2 FBD Editor ...................................................................................................................................................................3
9.2.1 Execution Rules......................................................................................................................................................3
9.2.2 Function Block Types .............................................................................................................................................4
9.2.3 Functions in FBD....................................................................................................................................................4
9.2.4 FBD Pane...............................................................................................................................................................5
9.2.5 Toolbar Buttons......................................................................................................................................................6
9.2.6 Inserting a Function / Function Block......................................................................................................................7
9.2.7 EN Input Parameter ................................................................................................................................................8
9.2.8 Editing Parameter Properties...................................................................................................................................8
9.2.9 Making Connections...............................................................................................................................................9
9.2.10 Inverting Connections.........................................................................................................................................11
9.2.11 Adding Comments ..............................................................................................................................................11
9.2.12 Structure Pane.....................................................................................................................................................12
9.2.13 Changing the Page Setup.....................................................................................................................................13
9.2.14 Inserting a Page Break ........................................................................................................................................13
9.2.15 I/O Connections to Variables ..............................................................................................................................14
9.3 Signal Tracing within Function Block Diagrams ..........................................................................................................15
9.3.1 Changing Values Online .......................................................................................................................................15
9.3.2 Tracing Values Online within one Code Pane........................................................................................................16
9.3.3 Analyzing Function Blocks in Online Mode ..........................................................................................................17
9.3.4 Analyzing Parameters on Function Blocks ............................................................................................................18
9.3.5 Analyzing the FB Functionality.............................................................................................................................20
9.4 Find and Search Tools .................................................................................................................................................21
9.4.1 Searching for Variables in Code Blocks ................................................................................................................21
9.4.2 Searching for Variables in Programs .....................................................................................................................22
9.4.3 Search for Variables in Projects ............................................................................................................................23
9.4.4 Navigating to References ......................................................................................................................................25

Chapter 9 - 1

T308-09 Signal Tracing in FBD - RevC

9.1 General Information


9.1.1 Objectives
On completion of this chapter you will be able to:

Configure simple application code

Connect I/O signals to variables

Follow signal flows and analyze the code

9.1.2 Legend
>

Indicates when you go from one menu to a sub-menu

Italic

Indicates object and file names

Indicates dialog box buttons, tabs, menus etc.

Bold

Indicates important topics


Indicates start/explanation of student activity

9.1.3 Reference Documentation

Chapter 9 - 2

3BSE043732

Industrial IT 800xA Control and I/O


Application Programming Introduction and Design

3BSE035980

Industrial IT 800xA Control and I/O


Basic Control Software Introduction and Configuration

3BSE035981

Industrial IT 800xA Control and I/O


Extended Control Software Binary and Analog Handling

System 800xA Training

9.2 FBD Editor


Function Block Diagram (FBD) is a high-level graphical programming language. It
describes the POUs in terms of processing elements and displays the signal flow
between them, similar to electronic circuit diagrams.
It represents the function block and functions by graphical symbols (boxes), their input
and output parameters by pins of the boxes and the assignment of parameters by lines
between the pins. A comprehensive basic range of function blocks and functions are
available.
The FBD editor consists of the following major parts:

Structure Pane

FBD Pane

9.2.1 Execution Rules


The execution order of function blocks and functions is defined at first by the order of
their creation. The execution order is represented by the order of the graphic symbols
(boxes) in FBD "from the left to the right" and "from the top to the bottom".
You can change the execution order later by moving the selected function blocks and
functions "up" or "down" within the structure pane. Just drag-and-drop the function
block within the structure pane.

Chapter 9 - 3

T308-09 Signal Tracing in FBD - RevC

9.2.2 Function Block Types


Function blocks provide additional functionality for the programmer. ABB supplies a
large number of pre-defined function blocks in the standard libraries. For example, in
the library BasicLib there are function block types for timing, data conversion,
counting and much more. In the library ProcessObjExtLib there are function blocks
for valves and motors.
Instances of Function Block Types may be created in programs and Control Modules
in an application (provided the appropriate library is connected to that application).

9.2.3 Functions in FBD


The code shown in the diagram below consists of basic functions of ORs, ANDs and
NOTs. During run time each value can be seen dynamically. The small circle (Bubble)
in the line indicates an inversion of the signal.
The blocks with a & are ANDs, The blocks with >=1 are ORs. Note that the
intermediate values of the calculation can also be seen. The code shown below
represents the following logic.
E = (A and not B) or (C and D)

Chapter 9 - 4

System 800xA Training

9.2.4 FBD Pane


The FBD panes are the right upper and lower sub panes within the code pane if you
are working with the FBD editor. They contain the function block diagram of the POU
you are programming.
NOTE!
By default only the lower sub pane is shown.
You can drag the separation line just underneath the variable declaration
pane to access the upper sub pane.
The FBD panes contain:

Graphic symbols of function and function block (boxes)

Instance names of the function blocks

Comments attached to the function blocks and functions

Assignment of parameters in form of connection lines between the graphic


symbols

Comment of the page and footer

Use the FBD panes to:

Inspect the function block diagram of the POU you are programming

Select, copy and paste functions and function blocks

Create, modify and delete function blocks and functions

Edit instance name of function blocks and edit comments

Assign values to the parameters of function blocks and functions

Chapter 9 - 5

T308-09 Signal Tracing in FBD - RevC

9.2.5 Toolbar Buttons


There is a special toolbar in the Function Block Diagram editor, with shortcuts to
many of the commands found in the menu bar (or in the pop-up menus). You can see a
brief explanation (tool tip) of each button, if you hold the cursor over the button.

Toolbar
button

Menu Command
Insert > Function/Function
Block

Key
Ins

Tools > Edit Parameters


>Connect

Tools > Edit Parameters


>Disconnect

Tools > Edit Parameters >


Invert

Chapter 9 - 6

Description
Insert new function or function
block
Use this command to assign
variables and constants to the
selected parameter of a
function block or function.

Ctrl + D

Use this command to de-assign


a variable or constant from the
selected parameter of a
function block or function.
Use this command to invert a
Boolean input parameter of a
function block or function.

System 800xA Training

9.2.6 Inserting a Function / Function Block


There are several ways to insert a function/ function block;
1. Use the toolbar button
2. Choose Insert > Function/ Function block from the POU menu
3. Right click in the code pane and choose Insert Function / Function block

Insert the Function / Function Block


In the dialog window a list of available functions and function block types is presented
in the drop-down list.
NOTE!

Just type the first letters of the function name to jump to


that entry.

It is also possible to use the Browse button


to get an explorer-like overview of all
libraries and applications and their functions / function blocks. If you want to choose
from a list of previously used function block types, use the Local FB Declarations
button.

Connect Parameters
If it is a function/function block that supports configurable input parameters, these
inputs can be specified in the dialog window.
To go straight to the Connection dialog window, check Connect Parameters.
The EN checkbox makes the optional Enable parameter available (this is explained
in the next section).

Chapter 9 - 7

T308-09 Signal Tracing in FBD - RevC

9.2.7 EN Input Parameter


The EN property for functions and function blocks in FBD makes it possible to write
code that corresponds to IF statements in the Structured Text language.
The EN parameter should be connected to a bool variable just as any other bool
parameter.
When the EN input is true, the function or function block will be executed, otherwise
not. When the EN input becomes false, all outputs will keep their values from the
previous cycle of execution.
NOTE!

If a function has an EN input, it must be connected.

The EN parameter can be turned on/off when inserting a new function or function
block (see Insert Function/Function Block dialog section), or when editing the
parameter properties (see below).

9.2.8 Editing Parameter Properties


Some functions or function blocks supports configurable parameters. For instance the
number of inputs on an AND function can be modified.
By clicking with the right mouse button on a function (box) you will see a menu.
Select Edit Parameter Properties to change the size or type of the function.

Activate the checkbox Enable parameter, if required.


Insert / Delete Parameter
Right click on a parameter (pin) of the function block or function. Select Insert
Parameter to add a new, last parameter (pin). Select Delete Parameter to delete the
parameter (pin).
NOTE!

Chapter 9 - 8

This is only possible if the function or function block is


expandable.

System 800xA Training

9.2.9 Making Connections


If a parameter is to be connected to another parameter, one of them must be an output
parameter and the other one an input parameter.
NOTE!

An output parameter can be assigned to any number of


input parameters but never to another output
parameter.

There are basically two ways of connecting the parameters (pins) of a function or
function block: Either you connect the parameters one-by-one or you connect them all
at once.

Connect each Parameter Separately


Right click on the parameter (pin) of the function block or function (box) to which you
want to assign a variable or a constant and select Connect from the context menu.

Fill in the To field with a constant value or a variable name. To display a list of all
available variables, press Ctrl+J.
NOTE!

If you want to connect an OUT parameter to several


variables, separate the names with , (comma).
For example: Start1, Start2

Press OK to close the dialog window or Apply/Next to apply the connection and
go the next parameter.
The Direction setting together with the value in the Next: drop-down list
determine what will happen when the Next button is pressed. In the example in the
figure pressing Apply/Next will move the selection forward to the next unconnected
parameter.

If the user enters a name that is not recognized by the system (i.e. not declared) and
presses OK or Apply/Next, the system will ask the user if the unknown name
should be declared by the system.

Chapter 9 - 9

T308-09 Signal Tracing in FBD - RevC

Access to Variables with Structured Data Types


You gain access to the components by using the syntax:
<main_identifier>.<component>

For instance: NxxTemp is a RealIO variable. Type NxxTemp as main identifier and
then a . to see the structured variables.

Connect All Parameters


To connect several of the parameters in one action, it is best to bring up the Parameter
Connections editor. Right click and select Edit Parameter List.

Fill in the name of the variable in the actual Parameter field. Use the button
get a tree-like overview of the POU and its variables.

to

Connect from one Function Block to Another


To connect two parameters to each other, select one parameter (pin) by clicking on it
with the left mouse button. Press the Ctrl key while clicking with the left mouse
button on the other parameter (pin) that you want to connect to.
NOTE!

Be sure that you select one input parameter and one


output parameter.

Connect to a Previous Selection


To connect a parameter to another parameter, select the first parameter by clicking on
it with the left mouse button. Click on another parameter (pin) that you want to
connect to with the right mouse button.
By this, you select the second parameter, though the selection of the first one remains,
and you open the context menu. Select Connect to Previous Selection from the
context menu to accomplish the connection.

Chapter 9 - 10

System 800xA Training

9.2.10 Inverting Connections


To invert inputs to a function or function block right click on the input parameter, and
select Invert from the menu.

A small circle (bubble) will appear on the input parameter.

Signal Inverted

9.2.11 Adding Comments


It is possible to write comments to functions/function blocks and pages.
Edit Comments of Function Blocks and Functions
Select the function block or function to which you want to assign or edit a comment.
Select Edit Comment from the context menu and type in your comment.

Edit Page Comments


If you want to add a comment for a page in FBD, just right click and select Edit Page
Comment from the context menu.

Chapter 9 - 11

T308-09 Signal Tracing in FBD - RevC

9.2.12 Structure Pane


The structure pane is the left sub pane within the code pane. It contains a list of all
function blocks and functions of the current POU.
Use the structure pane to:

Get an overview of the POU.

Select, copy and paste function blocks and functions.

Create, modify and delete function blocks and functions.

Edit instance name of function blocks, edit comments.

Change the pagination and page comments.

Navigate within the program.

Change the order of execution in the FBD code pane.

The structure pane consists of the following sizable and movable columns:

Chapter 9 - 12

Item shows the type name of the function block or function with their properties
in parentheses

Comment shows the comment attached to the function block or function

Page Comment shows the comment on the top of the corresponding Function
Block Diagram page

Page No is given at the first function block or function of every page of the
Function Block Diagram

Instance shows the name of function blocks

System 800xA Training

9.2.13 Changing the Page Setup


It is possible to change the layout of the FBD pane by selecting Tools > Page Layout
> Page Setup in the menu bar. The settings in this page determine the page layout of
the currently displayed code block. The settings will be remembered by the system
even if the editor is closed.

The Template setting determines the page orientation and size.


If you want to change the default layout when inserting new FBD code blocks, go to
Tools > Setup and select the FBD/LD tab.

9.2.14 Inserting a Page Break


Select the function block or function to which you want to attach a page break. Right
click and select Insert Page Break from the context menu.
NOTE!

This action can only be done in the Structure Pane.

The FBD editor inserts the page break above this function block or function and
repaginates the Function Block Diagram code block.

Chapter 9 - 13

T308-09 Signal Tracing in FBD - RevC

9.2.15 I/O Connections to Variables


Only variables can be connected to I/O channels. All I/O access is carried out through
a variable connected to an I/O channel.

The data types BoolIO and RealIO should be used to make the connections as
discussed in a previous chapter. Both data types are defined by the system and have
the following main components:
Name

Data type

Description

Value

Bool

Value used by the application code

IOValue

Bool

Value of the I/O channel. IOValue and Value are equal if


the channel is not forced.

Forced

Bool

Indicates whether or not the channel is forced (normally it


should be false).

Status

Dword

Status as a hexadecimal integer. The normal value is C0.

Use the Connection Tab of the hardware configuration editor to make connections
between Variables and I/O channels or other hardware channels.
NOTE!

Connections can be edited only in Offline mode.

It is possible to connect variables to I/O from the POU editor, but it is recommended
to do it from the I/O unit, because you cannot browse to the correct I/O address from
the I/O address column in the POU editor.

Chapter 9 - 14

System 800xA Training

9.3 Signal Tracing within Function Block Diagrams


9.3.1 Changing Values Online
When a controller project is in online or test mode, it is possible to inspect and interact
with the code while running it. From the Project Explorer in online mode, you have
access to editors similar to those in the offline mode.
One or several new online editor windows can be opened from the Project Explorer by
double-clicking on the Program Organization Unit you want to view. You can also
select the POU, click the right mouse button, and select Online Editor.

By using the online editors the code currently running in the controller(s) can be
inspected. Variable values and parameters can be changed.

Chapter 9 - 15

T308-09 Signal Tracing in FBD - RevC

9.3.2 Tracing Values Online within one Code Pane


Select a line that connects the pins of function blocks or functions which has a page
reference on either input or output terminals. Click near to an input pin and use the
Go To Source command to navigate to the source of the variable that is assigned to
the selected parameter. Click near to an output pin and use the Go to Sink command
to navigate to the parameter(s) to which the selected parameter is assigned. In the case
of multiple sinks, browse with the "<-" and "->" buttons in the Go To Sink dialog box.
Both the above commands will be grayed out if no connections are made between
multiple pages.
NOTE!

Page reference

Page Number

Chapter 9 - 16

The Go To Source and Go to Sink commands can only be


used to trace values within one Code Pane.
Page reference

System 800xA Training

9.3.3 Analyzing Function Blocks in Online Mode


The Function Block shown in the diagram below is a ValveUni and is used for
controlling devices with one control (Out1) and two feedback contacts (FB1 and FB0).
There are numerous pins besides those actually used to control and monitor the device.
Certain signals have mandatory connections. These are the signals where the
connection pin passes through the function block. The line passing through the block
indicates that there are both input and output components of the signal (structured data
types).
NOTE!

Only signals using simple data types can be viewed


directly on the Function Block.

Mandatory
connection

As the input and output signals are structured data types they can only be viewed at
the place where they are declared. In our case these are global variables on
Application level.

In online mode this variable can be expanded to view the value of the components.

Chapter 9 - 17

T308-09 Signal Tracing in FBD - RevC

9.3.4 Analyzing Parameters on Function Blocks


The ValveUni block has the following parameters:

Descriptions of all parameters for a Function Block can be found in the Libraries. This
information can be viewed in both online and off line mode. Open the required Library
select the Function Block and view the Editor.

Chapter 9 - 18

System 800xA Training

NOTE!

The Editor is read only.

Chapter 9 - 19

T308-09 Signal Tracing in FBD - RevC

9.3.5 Analyzing the FB Functionality


If help is required to determine how a particular function block works, highlight the
block and press <F1>. This will bring up a contextual help page.

Chapter 9 - 20

System 800xA Training

9.4 Find and Search Tools


The Find and Search tools provide fast access to text/variables in Declaration pane,
Code pane, Message pane or Project by clicking on the following icons:

Toolbar
button

Menu Command

Key

Description

Edit > Find

Ctrl + F

Find text in the using Pane in


the POU editor and jump to the
first occurrence

Edit > Find Next

F3

Jump to the next occurrence in


the using Pane

Edit > Find in Editor

Edit > Search

Find all text in the using POU


editor and list results in
Message Pane. You can jump
to the occurrence by double
clicking on the result
Alt + F12

Powerful search tool. See next


section

9.4.1 Searching for Variables in Code Blocks


First open the program you want to search in and then click on Find.

A Find will only check for the search text in the opened Code tab in the POU.

With the standard settings, searching for a short text like A will find every letter A
in the open Code tab. If the variable you are looking for really is called A you
should check the Match whole word only box. Match case will only find the
variable if it is written exactly like the search text even with respect to the capital
letters.
If you select a variable or parameter in the declaration pane and then do a Find the
name of the variable will be inserted automatically.

Chapter 9 - 21

T308-09 Signal Tracing in FBD - RevC

9.4.2 Searching for Variables in Programs


First open the program you want to search in and then click on Find in Editor.

Find in Editor works similar to Find which is described in the previous paragraph.
The main difference is that now the whole POU gets searched and not only the opened
Code tab.
Search for a variable using the same option as mentioned previously.

In this example you will find 3 occurrences in the SxxPrg_React.TankControl.Prg


program.

When occurrences of that word are found, they will be shown in the Find in Editor
pane of the lower part of the POU. Here you can jump to the occurrence of the word
by double clicking on the text. A right click will show a menu with a Go to button.

Chapter 9 - 22

System 800xA Training

9.4.3 Search for Variables in Projects


The Search and Navigation dialog can be accessed by selecting it from the Edit menu,
or by right-clicking on a Project Explorer object (not Tasks) and select Search.

Search For:
Enter the text to search for. Search options (see below) can be selected for the entered
text. An empty text or an asterisk (*) character in the text field search for all texts. All
texts are case-insensitive, that is, a search for the texts "my", "My", "mY" and "MY"
gives the same search results.

Chapter 9 - 23

T308-09 Signal Tracing in FBD - RevC

Search In:
The selection in the drop-down list specifies the scope of the search. By default it
searches in the POU where you started the search.

Search Options
The default setting is Match whole word. The Match substring option searches for
all texts containing the entered text as a substring. And the Match prefix option
searches for all texts containing the entered text in the beginning of words.
Filter Result
This option makes it possible to show references with write accesses only, or to show
references with read accesses only. The possible selections are shown in the picture.
I/O Channel Out shows references to output channels only and I/O Channel In
shows references to input channels only.
Always on Top
If Always on Top is checked, the Search and Navigation dialog is placed in front of
all other Windows dialogs.

Rebuild (offline mode only)


By default the search data is rebuilt when Control Builder is entering online mode or
test mode. This setting ensures that the search data is consistent in online mode
compared to offline mode. By accessing Tools > Setup > Station > Search and
Navigation Settings, the user can configure when to perform an automatic Rebuild

Click the Rebuild button to rebuild the Search data base.

Chapter 9 - 24

System 800xA Training

9.4.4 Navigating to References


In the references pane you can double click on the blue texts. A POU editor opens on
the right code pane. If the code is written in for instance FBD you will also be shown
the right page of this code tab. On the page you will have to look for the exact
location. If necessary you can do a Find to find it on the page.

NOTE!

Search can find a text occurrence in the project. But it


can not trace a parameter out of a Function Block or
Control Module. You will have to find out what the
connection is called and then search for that variable.

Chapter 9 - 25

T308-09 Signal Tracing in FBD - RevC

Chapter 9 - 26

Das könnte Ihnen auch gefallen