Skip to main content

BACnet 运行时配置

CODESYS BACnet2 SL 使用 CmpBACnet 或者 CmpBACnet2 用于通信的组件。该组件必须在运行时的配置文件中输入和配置,如下所示。

[ComponentManager]
Component.1=CmpBACnet2

[CmpBACnet2]
; IniFile=$PlcLogic$/bacstac2.ini
; The configuration of the BACnet stack is generated by the CODESYS BACnetServer durign startup,
; if the BACnetServer device parameter  g is set to TRUE (which is the default).
; Most likely IniFile= needs to be configured only, if there is a need to manually create a configuration file of the BACnet stack,
; or if another path in the PLC filesystem is required.
; IniFile=$PlcLogic$/bacstac2.ini

; Task priority of the BACstack process task - this is an optional configuration, default is TASKPRIO_NORMAL_END (159).
; The task priority only needs to be configured, if there is a real need 
to work with IEC task priorities and runtime component task priorities,
; on some very specific PLC's.
; TaskPrio=128

; Name of the named pipe for the communication with the BACstack - this is an optional configuration.
; By default this named pipe is generated at "\\\\.\\pipeCODESYSBACnetServer" on Windows PLCs or "/dev/CODESYSBACnetServer" on Linux (or any other) PLCs.
; Just in case the PLC filesystem is configured such, that there is no create/write permission for this specific path,
; there is e need to configure AppName=.
; AppName=/tmp/BACnetServer

一般来说, CODESYS 将对 IEC 应用程序内的文件系统的访问与对运行时组件的程序代码的访问分开。可以在运行时的配置文件中指定不同的根目录。

[SysFile]
; root file path for runtime components
FilePath=D:/Temp/Default
; root file path for IEC applications
IecFilePath=D:/Temp/IEC

什么时候 AutoGenerateBACstackConfig 设置为 TRUE,一款 IEC 应用程序 CODESYS BACnet2 SL 写入的配置文件 BACnet 堆栈(使用来自的信息) BACnet.BACnetIPdatalink) 启动时 BACnet 服务器。 稍后在启动例程中,运行时系统组件中的代码 CmpBACnet 读取配置文件。因此,必须为此配置文件启用 IEC 应用程序和运行时组件的共享读写权限。这可以通过使用绝对路径或使用占位符来完成( CODESYS 控制 V3.5.16.0 及更高版本)。

绝对路径:

...
[CmpBACnet2]
IniFile=D:/Temp/bacstac.ini ; Windows
; Linux -> IniFile=/tmp/bacstac.ini
...

占位符(示例: $BACnet$):

...
[SysFile]
PlcLogicPrefix=1
PlaceholderFilePath=, $Firmware$
PlaceholderFilePath.1=$PlcLogic$/bacnet, $BACnet$

[CmpBACnet]
IniFile=$BACnet$/bacstac.ini
...

此外, CODESYS 允许运行时各个方面的“沙箱”,包括对文件系统的访问。在这种情况下,对 IEC 应用程序内的文件系统的访问以及来自运行时组件的程序代码的访问仅限于配置的路径。欲了解更多信息,请参阅配置 SysFile

...
[SysFile]
; ForceFilePath=1
; ForceIecFilePath=1
...

有关这方面的更多信息,请参阅帮助 CODESYS 控制 V3 运行时系统,“CODESYS 控制文件路径和占位符”。此帮助可在 CODESYS GmbH 客户门户

在配置文件系统的“沙箱”时,您应该注意,可以访问文件系统的配置文件 BACnet 如上所述的堆栈。因此,在这种情况下,当路径到达时,需要使用占位符作为替代方案。 bacstac.ini 尚未在其他地方配置。

有关更多信息,请参阅: 架构、组件及其任务