How to compile and run Function Blocks in FBench

Before you begin

Extract the FBench software to a directory of your choice (eg. C:\FBENCH\).
FBench needs to know the location of the Java compiler. If you do not have it please go to and install the JDK.

Edit preferences.ini so that the path to javac points to your installation of javac.
eg. The first line of preferences.ini may read:

javac \\Program Files\\Java\\jdk1.6.0\\bin\\javac -classpath ./fbrt.jar;

a) Start FBench by running FBENCH.BAT in the root of your installation directory.

b) Click OK to dismiss the splash screen.

c) Click the 'File' menu and select 'Open' to open a function block file. Alternatively, you can press the 'Alt-O' keyboard shortcut.

d) Browse to the ita folder and select FLASHER4.FBT, then click OK.

e) When the block has been loaded you will be presented with the main view in FBench.

Layout of FBench


(1) On the far left is the toolbar - It holds shortcut buttons for parsing changes to the XML document, saving, closing tabs and jumping to the next or previous tab.

(2) The large view area in the upper middle displays the layout of the FLASHER4 function block. Visible are the blocks input and output events and variables, as well as their associations and names. It is also used to edit the block's ECC and Algorithms.

(3) The right area displays the element tree. From here, version and compiler information, the block's ECC and algorithms can be accessed. Clicking on nodes in the tree changes the central view to reflect your selection.

(4) Below the tree is the Properties window, which displays editable properties for the selected element. For example, when the top-level node in the tree is selected, the attributes 'Name' and 'Comment' are visible - to edit their values double click on the corresponding cell in the 'Value' column.

(5) The bottom area displays the XML text for the current block. When an element is selected in the tree or main view, the corresponding XML element is highlighted. Also available are the SRC and Java source code for the block, displayed as tabs.

Using examples: modifying and compiling FLASHER4, running FLASHER_TEST

FBench uses same examples set as FBDK (courtesy Holobloc, Inc.). Sources of function block types are located in /src folder.

FBench also uses FBRT (provided as fbrt.jar -- again courtesy of Holobloc) to run function block systems and single function blocks in the "Test environment'. However, its compiler is completely different from FBDK's, but it produces very similar results, so the generated Java classes are compatible and can run together. 

For example, popular FLASHER_TEST.sys located in /src/ita can be used to illustrate current status of the FBench compile and run functionality. The essential part of FLASHER_TEST is basic function block FLASHER4.

Editing FLASHER4

Open the function block FLASHER4. You can change its content, e.g. name, version, etc., by selecting nodes in the elements tree and double-click on their value in the Property window (below the tree). Press Enter confirm the change.


Currently FBench has only text editor for representing algorithms in Structured Text language (no Ladder editor, etc.). You can edit Ladder directly in XML, though. However, there is no compiler of ladder diagrams.


You can edit algorithms by clicking on their names in the elements tree.


Save the block by selecting File menu, Save as, then choosing XML... The block is automatically placed in the correct folder of the source tree (using the package name, i.e. if you changed package name to, the block type will be saved to /src/xxx folder).

To change the package that the block is compiled in, select the 'CompilerInfo' tree node.

Compiling FLASHER4

Compile the block by opening the 'Compile' menu and selecting 'Compile Java'. Alternatively, press 'Alt-J'.

A results dialog is displayed. On the left is the Java source code belonging the block, and the right panel displays the compilation results. If the operation was not successful any errors will be displayed here. Click 'OK' to dismiss the dialog.

The block is now ready to be launched in the 'Test environment'. Open the 'Run' menu and choose the 'Launch' submenu. Select 'Launch'. A new dialog should be displayed representing your MYFLASHER4 block. Input events (INIT and REQ) are displayed as buttons, and output events as LED's (the circles on the right-hand side, currently black). The input variable, MODE, is presented as a text field, and the output variables LED0 to LED3 are also LED's (They are type BOOL. Other types, for example an INT value, may have another widget such as a text field.)

NOTE, that only COUNT_UP and COUNT_DOWN modes (MODE=1 and MODE=4) work correctly as all other algorithms are written in Ladder logic and are not compiled.


Open FLASHER_TEST.sys and see that it works with the FLASHER4 compiled by FBench!

Other things to try

Browse the source library and check other examples. NOTE: Not all blocks will compile successfully. These are known issues.

Create a new block. To do this, select File > New > FB Type > Basic. Remember to change the name of your new block (using the Property table) to avoid overwriting the Basic template.

Export\Import a system. Select File > Project Environment. This dialog allows one to create a new 'Project', where a System file and all associated FB files are copied from the source tree to a destination folder. They can also be packed into a JAR archive for portability. To import a project, choose 'Import' and select a generated .prj or .jar file.

Check out the example plugin. Open exampleplugin.xml in any Text or XML editor.

It is not obvious in the current version, but you can associate events with input or output variables by holding the right mouse button and dragging from an event to a variable and releasing the mouse. EC States can also be connected in a similar manner. In future versions of FBENCH there will be a visible indication of this functionality.

V.Vyatkin and FBench team, (C) University of Auckland, 10th of June, 2007