BACnet Configuration in the Runtime
CODESYS BACnet2 SL uses the CmpBACnet
or CmpBACnet2
component for communication. This component has to be entered and configured in the configuration file of the runtime as follows.
[ComponentManager] Component.1=CmpBACnet2 [CmpBACnet2] ; configuration file of the BACnet stack IniFile=$PlcLogic$/bacstac2.ini ; task priority of the BACstack process task, default: TASKPRIO_NORMAL_END (159) TaskPrio=128 ; name of the named pipe for the communication with the BACstack AppName=/tmp/BACnetServer
In general, CODESYS separates access to the file system within the IEC application and access from the program code of the runtime components. Different root directories can be specified in the configuration file of the runtime.
[SysFile] ; root file path for runtime components FilePath=D:/Temp/Default ; root file path for IEC applications IecFilePath=D:/Temp/IEC
An IEC application with CODESYS BACnet2 SL writes the configuration file of the BACnet stack (using information from BACnet.BACnetIPdatalink
) when starting the BACnet server and then reads the file within the CmpBACnet
runtime component. Therefore, shared read and write access of the IEC application and the runtime component have to be enabled for this configuration file. This is done either by using an absolute path or by using placeholders (for CODESYS Control V3.5.16.0 and higher).
Absolute path:
... [CmpBACnet2] IniFile=D:/Temp/bacstac.ini ; Windows ; Linux -> IniFile=/tmp/bacstac.ini ...
Placeholder (example: $BACnet$
):
... [SysFile] PlcLogicPrefix=1 PlaceholderFilePath=, $Firmware$ PlaceholderFilePath.1=$PlcLogic$/bacnet, $BACnet$ [CmpBACnet] IniFile=$BACnet$/bacstac.ini ...
Furthermore, CODESYS allows for the "sandboxing" of various aspects of the runtime, including access to the file system. In this case, access to the file system within the IEC application and access from the program code of the runtime components are restricted to the configured paths. For more information, see the configuration of SysFile
:
... [SysFile] ; ForceFilePath=1 ; ForceIecFilePath=1 ...
For more information about this, see the help for CODESYS Control V3 Runtime System, "CODESYS Control FilePath & Placeholders". This help is available in the CODESYS GmbH Customer Portal.
When configuring the "sandboxing" of the file system, you should note that it is possible to access the configuration file of the BACnet stack as described above. Therefore, the alternative using placeholders is required in this case when the path to bacstac.ini
is not already configured elsewhere.
For more information, see: Architecture, Components, and their Tasks