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
- namespace
set of unique symbols, each in one-to-one correspondence with a corresponding member of a set of unique library elements - library element
collection of declarations applying to a data type, function block type, adapter type, subapplication type, resource type, device type, segment type, or system configuration - library element name
identifier associated with and designating a library element - software library
set of library elements whose fully qualified names form a single namespace - fully qualified name
library element name preceded by its package name and separated from it by a "full stop" ("."
) character - package name
symbol identifying a package, consisting of a sequence of identifiers, separated by the "full stop" ("."
) character - package
set of library elements, whose library element names form a single namespace - source library
software library whose elements are accessible in the formats defined in Annex A of IEC 61499-2 - runtime library
software library whose elements are accessible in a format suitable for execution by a runtime platform - runtime platform
device or resource
Constraints
Library management
The use of namespaces for the management of software libraries is constrained by the following rules:
- The set of library element names for all of the library elements in a package shall contain no duplicate, null or empty identifiers.
- 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.
- The namespace of a software library shall consist of the union of the namespaces of its contained packages.
- 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:
- 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
andIMPORT
declarations, which shall precede all other declarations in the library element, using the syntactical elementlibrary_declarations
defined below.- The use of the
[fb_type_list]
and[resource_type_list]
options in theresource_type_specification
anddevice_type_specification
syntax, respectively, is eliminated, since they are redundant with theimport_declarations
syntax.
- The use of the
- 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 modifiedCompilerInfo
element shown below is encoded using the textual syntax for thepackage_name
element. - The
import_declarations
textual element is encoded as theImport*
contents of the modifiedCompilerInfo
element, where thedeclaration
attribute of theImport
element is encoded using the textual syntax for theimport_declaration
element. - The use of the
header
attribute of theCompilerInfo
element for this purpose is deprecated.
- The
- 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:
- If there exists exactly one fully qualified name within the library element's namespace with its library element name equal to the referenced type name, then that type name is associated with the library element with that fully qualified name.
- If there exist more than one fully qualified names within the library element's namespace with their library element names equal to the referenced type name, then that type name shall be expressed as the fully qualified name to be used.
- It is an error if there exists no fully qualified name within the library element's namespace with its library element name equal to the referenced type name.
Syntaxes
Tool Support
The features described below have been implemented in the FBDK to support the proposed Library Management extensions.
- The online
LibraryElement
orDataType
Document Type Definition (DTDs) have been modified to include the revisedCompilerInfo
and the newImport
elements. - The current FBDK implementation utilizes a
map.ini
file that only supports one-to-onelibrary element name
⇒fully qualified name
mappings. Future versions of the FBDK may utilize one-to-many mappings to support multi-vendor systems; this would require some modifications to the features described below. - In this context, the namespace of
a library element can be considered
to be the union of the library element's
CompilerInfo.packageName
andImport.declaration
attributes.
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:
- The
Import
elements contained within theCompilerInfo
elements are modeled internally as a Set of Strings to avoid duplicate or null elements. This Set is initially populated with the default Strings"fb.datatype.*"
and"fb.rt.*"
- If the source
CompilerInfo.header
attribute contains a declaration in the form package <package_name>; the package_name String is stored as thepackageName
attribute of the internalCompilerInfo
element. - If the source
CompilerInfo.header
attribute contains any declarations in the form import import_declaration; the import_declaration String is stored as a new member of the internal Set ofImport
Strings, subject to the following constraints:- If the import_declaration is in the form package_name.*
and it is not already in the namespace, it is added to the
Import
set, and any members of the namespace in the form package_name.library_element_name are deleted. - If the import_declaration is in the form package_name.library_element_name
and it is not already in the namespace, and no members of the
namespace are in the form package_name.*, it is added to
the
Import
set.
- If the import_declaration is in the form package_name.*
and it is not already in the namespace, it is added to the
- The internal
CompilerInfo.header
attribute is then set equal to the sourceCompilerInfo.header
attribute with all the Strings matched in the preceding two steps removed. - The remaining
Import.declaration
attributes contained in the sourceCompilerInfo
elements are then added to the nameset.
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.