Build and Test a Basic Function Block Type

  1. Start the FBDK.
  2. Import library elements if and as needed.
  3. Create a new basic FB type in the editor by double-clicking on the Basic fb type of the template folder in the Library Navigator.
  4. Edit the function block's elements:
  5. When your editing is complete, save your work with the Save As... =>XML dialog.
    It is a good idea to save your work from time to time while editing, too!
  6. Generate and compile a Java® source file with the Save As... =>Java dialog. The results of the compilation (including errors, if any) will be displayed in the Log tab of the Text panel, and a dialog will open indicating whether the compilation has succeeded or not.
  7. Test the FB type by clicking the Run menu item of the root node in the Element Navigator. 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.
    • The Run menu item will only be enabled if a compiled .class file is available, either in a subdirectory of the lib folder or in the fbrt.jar library.
    • You can open more than one test window a a time on the FB Type; each test window will have its own instance of the FB type and its own window number in parentheses in the title bar.
    • The FB type is defined as Running as long as at least one test window is opened on an instance of it; this is indicated by outlining its interface in green.
    • To prevent inconsistencies between running and edited versions, only the Run option will be enabled in the popup menu when the FB type is Running.
    • After all the test windows have been closed, the FB type is no longer Running, and its interface outline returns to its normal appearance.
    • 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.
  8. Document your work. It's not done until it's documented!