Library Management

Overview

The FBDK now provides tool support for an experimental subset of the library management framework proposed for inclusion in the Third Edition of IEC 61499. This framework utilizes formalized definitions, constraints, and textual syntaxes to specify the requirements for the management of software libraries, and in particular provides a means of distinguishing among library elements with the same library element name from multiple suppliers.

As illustrated in the figure below, this framework partitions library elements into packages, which in turn are organized into software libraries.

Definitions

Constraints

Library management

The use of namespaces for the management of software libraries is constrained by the following rules:

  1. The set of library element names for all of the library elements in a package shall contain no duplicate, null or empty identifiers.
  2. The namespace of a package shall consist of a set of fully qualified names in one-to-one correspondence with the set of library element names contained in the package.
  3. The namespace of a software library shall consist of the union of the namespaces of its contained packages.
  4. The namespace of a library element contained in a software library shall be a subset of the namespace of the software library.
    • NOTE - Per the mathematical definition of subset, this constraint includes set identity.

Type name resolution

The use of namespaces for the resolution of type names occurring in the declarations of library elements (for instance, the FB type name declared for an FB instance, or the data type name declared for a variable) is constrained by the following rules:

  1. When the textual syntax defined in Annex B of IEC 61499-1 is used, the namespace of a library element consists of the union of the namespaces declared in its PACKAGE and IMPORT declarations, which shall precede all other declarations in the library element, using the syntactical element library_declarations defined below.
    • The use of the [fb_type_list] and [resource_type_list] options in the resource_type_specification and device_type_specification syntax, respectively, is eliminated, since they are redundant with the import_declarations syntax.
  2. When the XML syntax defined in Annex A of IEC 61499-2 is used, the equivalent of the textual library_declarations element is encoded as follows:
    • The packageName attribute of the modified CompilerInfo element shown below is encoded using the textual syntax for the package_name element.
    • The import_declarations textual element is encoded as the Import* contents of the modified CompilerInfo element, where the declaration attribute of the Import element is encoded using the textual syntax for the import_declaration element.
    • The use of the header attribute of the CompilerInfo element for this purpose is deprecated.
  3. Each type name occurring in the declarations of a library element is associated with exactly one fully qualified name within the namespace of the library element according to the following rules:

Syntaxes

Textual syntax
library_declarations ::= package_declaration [import_declarations]
package_declaration ::= 'PACKAGE' package_name ';'
package_name ::= identifier {'.' identifier}
import_declarations ::= 'IMPORT ' import_declaration {',' import_declaration} ';'
import_declaration ::= package_name '.' ('*' | type_name)
type_name ::= data_type_name | fb_type_name | adapter_type_name
   | segment_type_name | resource_type_name | device_type_name

XML syntax
<!ELEMENT CompilerInfo (Compiler*, Import*)>
<!ATTLIST CompilerInfo
  packageName CDATA #IMPLIED
  header CDATA #IMPLIED
  classdef CDATA #IMPLIED>
  
<!ELEMENT Import EMPTY>
<!ATTLIST Import
  declaration CDATA #IMPLIED>

Tool Support

The features described below have been implemented in the FBDK to support the proposed Library Management extensions.

Opening Library Elements

When a library element in the FBDK's source library is opened by double-clicking on the element in the FBDK's Library Navigator pane, an internal representation of the library element's declarations is created, modeled on the XML DOM (Document Object Model) defined by the LibraryElement or DataType Document Type Definition (DTD), as specified in the library element's DOCTYPE declaration. Library management information contained in the library element's CompilerInfo declaration is entered into the internal DOM in the following sequence:

Import/Deport/Package

A package name can be explicitly Imported (added to the library element's nameset), Deported (deleted from the library element's nameset), or set as the library element's Package name from the popup menu of the corresponding folder in the Library Navigator pane.

Similarly, a fully qualified name can be explicitly Imported or Deported (deleted from the library element's nameset) from the popup menus of the corresponding library element in the Library Navigator pane.

DOCUMENTATION TO BE ADDED: Automatic restriction of popup menu items based on allowable operations.

Automatic Updating of namespaces

Documentation of how namespaces are cleaned up and text panes updated every time anything is edited.

Saving Files

Minimal documentation needed here - everything is already done by auto-updating of namespaces.