Build and Test a Simple Function Block Type

You can use the FBDK to build a subset of the simple function block type described in Annex D.2 of IEC 61499-1:
  • The event interface is restricted to a single REQ/CNF pair.
  • The body of the block is restricted to a single REQ algorithm.
  • Upon occurrence of an event at the REQ input, the REQ algorithm is executed, following which an event is issued at the CNF output.
These restrictions permit the generation of somewhat more efficent runtime code, as well as simplifying the programming of simple FB types.
To build a new simple FB type, use the following steps:
  1. Start the FBEditor.
  2. Create a new simple FB type in the editor by clicking the
    New=>FB Type=>Simple menu item, as shown at right.
  3. Edit the function block's elements:
    • Edit the FB type's properties.
      • Be sure to enter package fb.rt.<mypkg>; in the Compiler Info header field, where <mypkg> is the name of the src subdirectory you are working in, for example, student or book.
      • Don't edit the classdef field; leave it saying SimpleFB.
    • Edit the FB type's interface. You won't be able to add or edit events, since only the REQ/CNF pair is allowed.
    • Double-click on the REQ algorithm in the Navigation panel to bring up an editing dialog for the algorithm.
  4. When your editing is complete, save your work with the Save As... button.
    It is a good idea to save your work from time to time while editing, too!
  5. Generate and compile a Java® source file with the Save As... button. A dialog window will open showing the Java source text and the compilation results.
  6. Test the FB type by clicking Run button. In the test window, you can set or clear the values of the inputs, click on event input buttons and observe the resulting event and variable outputs.
    • If you change the code of the block and recompile, you will have to exit the FBEditor application and restart it in order to force a reload of the class file.
Last updated: 2011-02-12.
©2011 Holobloc Inc.
Licensed under the Academic Free License version 3.0.
Java is a registered trademark of Oracle Corporation and/or its affiliates.