Skip to main content

Architecture, Components, and their Tasks

CODESYS BACnet2 SL and CODESYS BACnet(1) SL each contain three IEC libraries:

  • CmpBACnet, CmpBACnet2

  • BACnet, BACnet2

  • BACnetDefaultImpl, BACnet2DefaultImpl2

(Note: The following descriptions apply to both "variants" of a library.)

The package also includes the BACnet plug-in for the CODESYS development environment, which performs consistency checks on library versions and BACnet object IDs, as well as providing EDE export/import.

The BACnet stack (BACstack) is an optional component of the CODESYS runtimes (CmpBACnet component).

The CmpBACnet IEC library represents the integration of the BACnet stack into a CODESYS IEC environment and provides the BACnet data types as well as the BACstack methods. The sole use of the IEC library CmpBACnet (without the BACnet and BACnetDefaultImpl libraries) would result in complex and lengthy IEC application code.

For more information, see: When to Use the BACnet Library or the CmpBACnet Library

The BACnet library simplifies BACnet application development considerably as compared to the sole use of CmpBACnet, especially in the following areas:

  • Starting and stopping the BACnet stack

  • Using BACnet server objects and their properties

  • Triggering asynchronous requests (mainly "client service requests") and processing the "request transaction"

  • Processing of "callbacks" from the BACnet stack (see IBACnetEventConsumer) and distributing the "callbacks" to multiple receivers in the application

Furthermore, the BACnet library provides a plug-in mechanism (BACnetServerPlugin) for extending certain aspects of the BACnet library. BACnetServerPlugin is the basis for the BACnetDefaultImpl library.

The BACnetDefaultImpl library is used for the additional simplification of BACnet application development. The BACnet standard ASHRAE 135 leaves some aspects of the practical use of BACnet open. The most notable examples include the following:

  • Persistence of server objects

  • Storage and persistence of Trend Log, Trend Log Multiple, and Event Log entries

  • Update of the date/time information of the device object

CODESYS implementations for these aspects are necessarily based on some assumptions about the PLC and the application, for example:

  • The PLC has a file system.

  • The PLC file system does not have excessively strict limitations regarding data volume, speed, or number of write cycles.

Due to these assumptions, such implementations cannot be permanently included in the BACnet library, because this would prevent the implementation of other use cases and the compliance with other constraints.

The BACnetDefaultImpl library is the place for these kinds of "default implementations". In the best case, if the assumptions are correct, then these standard implementations can be used easily. If the assumptions do not apply, then a standard implementation of a particular aspect can be used very well as an example and a basis for a PLC/application-specific implementation.

For this reason, the BACnetDefaultImpl library is supplied both as a compiled library and as a source code library.