Skip to main content

BACnet Configuration in the CODESYS Project

BACnet configuration in the device tree and device editor

In CODESYS, you can insert a BACnet server and BACnet objects as devices below a PLC device in the project tree. The BACnet server represents the BACnet device and handles the communication with the runtime system.

One server device is possible per application, including the object devices as children. You can also insert BACnet clients below the server.

Requirement: The CODESYS BACnet2 SL package is installed. A project with a BACnet-capable PLC device has been created.

  1. Select the PLC device in the project tree and click Project → Add Device to add a BACnet Server.

  2. Select the BACnet server in the tree and insert the required BACnet objects below it.

    Servers and objects are provided with an initial configuration which conforms with the AMEV recommendations for AS-A and AS-B. This is illustrated in the generic device editor.

  3. Double-click the BACnet server entry or a BACnet object entry to open its device editor.

    On the BACnet Interface Parameters tab, you can modify the initial configuration in the Value column.

    Tip

    A complete configuration of server and object properties by means of this device configuration editor is not possible. This is possible by means of IEC program code. See below.

For more information, see: BACnet configuration using application code

Export and import of a BACnet configuration in EDE format

You can import and export the current BACnet configuration (located in the device tree of the project) to and from CSV files in EDE format (Engineering Data Exchange).

The functionality is based on the "Template for the Exchange of Engineering Data for BACnet Systems" as an Excel file.

The export writes the required as well as optional information about the BACnet configuration to the base export file *_EDE.csv. In doing so, other CSV files with information about the "State Texts", "Unit Texts", and "Object Types" are created automatically: *_ObjTypes.csv, *_StateTexts.csv, and *_Units.csv.

Export:

The BACnet → Export to EDE File command opens the EDE Export dialog for the following input:

Project name

Name of the project that is currently being exported from.

Found in the <project name>.csv file at PROJECT_NAME

Version of the reference file

Version of the export file. Example: 1.0.0.0

Found in the CSV file at VERSION_OF_REFERENCE_FILE

Author of last change

Found in the CSV file at AUTHOR_OF_LAST_CHANGE

EDE file to export

Path of the location of the export file in the local file system.

Note: The name of the CSV file has to correspond to the following syntax: <name>_EDE.csv. Example: proj1_EDE.csv

Separator

Character that should be used to separate the text in the export file. Selection: comma, semicolon, space, or tab

Quoting

Specifies whether the exported texts in the EDE file should be placed in single quotation marks, double quotation marks, or no quotation marks.

Import:

The BACnet → Import from EDE File command opens the EDE Import dialog. Here you specify the following information for the import:

EDE file to import

In the file system, select an EDE file (*_EDE.csv) that contains the desired BACnet configuration. Any other CSV files (*_ObjTypes.csv, *_StateTexts.csv, *_Units.csv) that may be found are also read automatically.

Note: Only CSV files that correspond to the usual EDE file naming convention are included. See above: EDE file to export

Separator

The separator used in the selected CSV file is identified and set here automatically.

Quoting

The quotation mark used in the selected CSV file is identified and set here automatically.

Import EDE Information

Project name

Not editable. PROJECT_NAME from the EDE file.

Version of the reference file

Not editable. VERSION_OF_REFERENCEFILE from the EDE file.

Author of last change

Not editable. AUTHOR_OF_LAST_CHANGE from the EDE file.

Timestamp of last change

Not editable. TIMESTAMP_OF_LAST_CHANGE from the EDE file.

Version of layout

Not editable. VERSION_OF_LAYOUT from the EDE file.

Import Selection

BACnet device to import

The BACnet devices defined in the EDE file are available for selection. The import operation inserts the selected device into the device tree below the PLC to import to set below.

PLC to import to

The devices available in the project are available for selection. The imported BACnet configuration is inserted below the selected device.

BACnet(1) / BACnet(2)

Select the protocol revision which should be applied to the import.

BACnet2 - Protocol Revision 25

BACnet(1) - Protocol Revision 14/15

Tip

Note the following during import:

The EDE import ignores the following information which may be included in the EDE file:

  • Non-standardized BACnet object types (entry in the "Object Types" sheet of the data exchange template, and in the EDE file *_ObjTypes.csv)

  • Non-standardized BACnetEngineeringUnits, meaning unit codes (entry in the "Unit Texts" sheet of the data exchange template, and in the EDE file *_Units.csv)

  • The optional information "settable" (entry in the "EDE" sheet of the data exchange template, and in the EDE file *_EDE.csv)

  • The optional information "supports COV" (entry in the "EDE" sheet of the data exchange template, and in the EDE file *_EDE.csv)

Acceptance of EDE file entries into the BACnet device object:

  • The entry "keyname" is stored in the parameter "EDEkey".

  • The entry "vendor-specific-address" is stored in the parameter "EDEvendorSpecificAddress".

  • The "Unit Text" that belongs to the unit code is stored in the parameter "EDEunitText".

BACnet configuration using application code

So that you can access all configuration parameters and BACnet object properties with IEC program code, the BACnet library provides a function block for BACnet servers and another function block for BACnet objects. This is mapped to an instance variable on the I/O Mapping tab of the respective device configuration editor. Example: The BACnetAnalogValue function block is provided for the BACnet object BACnet Analog Value. This is automatically instantiated in the project by means of the variable BACnet_Analog_Value.

In this way, you can dynamically configure all BACnet properties of an object with your application.

For more information, see: Access to BACnet Objects and Their Properties