DrvBeckhoffPlc Communicator Driver (Custom)
Functional Description
DrvBeckhoffPlc is a custom Communicator driver in ScadaV6CommExt for field device connectivity. Protocol details follow the source implementation.
Scope and Version
- Source:
ScadaV6CommExt/DrvBeckhoffPlc.Logic - TFM:
net8.0 - Version:
6.0.0
Install and Enable
- Deploy driver binaries to Communicator folders.
- Activate driver in Administrator → Communicator → Drivers.
- Upload configuration and restart Communicator.
Line and Device Configuration
- Create a communication line with the proper channel type.
- Add device and set address/timeouts.
- Set polling options and CmdLine as required by this driver; see Functional notes and configuration (template and source) below for file names, address format, and line keys.
CustomOptions (extracted)
| Key | Default | Note |
|---|
RetryCount | — | Extracted from source; confirm meaning in driver implementation. |
UseTagCache | — | Extracted from source; confirm meaning in driver implementation. |
UseAutoAmsNetID | — | Extracted from source; confirm meaning in driver implementation. |
AmsPort | — | Extracted from source; confirm meaning in driver implementation. |
SenderAMSNetId | — | Extracted from source; confirm meaning in driver implementation. |
TargetAMSNetId | — | Extracted from source; confirm meaning in driver implementation. |
Code hints
27: protected DeviceTemplate deviceTemplate;
48: ConnectionRequired = false; //不使用默认连接池
92: string fileName = PollingOptions.CmdLine.Trim();
93: deviceTemplate = new DeviceTemplate();
108: InitPlcConnection();
125: if (plcDeviceSession.CheckPlcConnection(beckhoffAdsNet, deviceTemplate))
187: private void InitPlcConnection()
189: var deviceType = LineContext.LineConfig.CustomOptions.GetValueAsEnum("CpuType", CpuType.BeckhoffAdsNet);
190: RetryCount = (short)LineContext.LineConfig.CustomOptions.GetValueAsInt("RetryCount");
200: beckhoffAdsNet.UseTagCache = LineContext.LineConfig.CustomOptions.GetValueAsBool("UseTagCache");
201: beckhoffAdsNet.UseAutoAmsNetID = LineContext.LineConfig.CustomOptions.GetValueAsBool("UseAutoAmsNetID");
204: beckhoffAdsNet.AmsPort = LineContext.LineConfig.CustomOptions.GetValueAsInt("AmsPort");
208: beckhoffAdsNet.SetSenderAMSNetId(LineContext.LineConfig.CustomOptions.GetValueAsString("SenderAMSNetId"));
209: beckhoffAdsNet.SetTargetAMSNetId(LineContext.LineConfig.CustomOptions.GetValueAsString("TargetAMSNetId"));
214: Log.WriteAction($"[Channel]TcpClientChannelOptions, host: {tcpClientChannel.Host}, port: {tcpClientChannel.TcpPort}");
216: beckhoffAdsNet.CommunicationPipe = new PipeTcpNet(tcpClientChannel.Host, tcpClientChannel.TcpPort)
222: IsPersistentConnection = true,
227: Log.WriteAction($"[Channel]UdpClientChannelOptions, host: {udpClientChannel.Host}, port: {udpClientChannel.TcpPort}");
229: beckhoffAdsNet.CommunicationPipe = new PipeUdpNet(udpClientChannel.Host, udpClientChannel.TcpPort)
234: IsPersistentConnection = true,
Administrator UI (DrvBeckhoffPlc.View)
Configure in Administrator → Communicator. Labels below come from the View language pack.
- View source:
ScadaV6CommExt/DrvBeckhoffPlc.View - Main forms:
| Phrase key | Text |
|---|
gbCmd | Command Parameters |
lblCmdCode | Command code |
lblCmdNum | Command number |
lblCmdAddress | Element address |
lblTemplateFileName | Device template |
ConfigDirRequired | The device template file must be located inside {0} |
TemplateNotExists | The device template file does not exist. |
btnAddCmd.ToolTip | Add Command |
gbTemplate | Device Template |
TemplateTitle | AllenBradley. Device Template Editor |
DuplicatedCmdNums | Duplicated command numbers: |
EmptyCmdCodes | Empty command codes found. |
AddressHint | {0}, starting from {1} |
lblCmdName | Name |
lblCmdCodeWarn | Fill out code |
lblCmdDataBlock | Data block |
chkCmdMultiple | Multiple |
lblCmdFuncCode | Function code |
lblCmdFuncCodeHex | Hexadecimal |
lblCmdElemType | Element type |
lblCmdElemCnt | Element count |
lblCmdByteOrder | Byte order |
lblCmdByteOrderExample | For example, 01234567 |
lblElemAddress | Address |
lblGrAddress | Start element address |
this | Device {0} Properties |
gbCommLine | Communication Line |
lblTransMode | Protocol |
gbDevice | Device |
btnEditTemplate | Edit |
Functional notes and configuration (template and source)
Derived from Logic/Common and device template XML: driver behavior and the Administrator/Communicator fields to set (address, CmdLine, line CustomOptions, template nodes).
Logic location
ScadaV6CommExt/DrvBeckhoffPlc.Logic- Common:
DrvBeckhoffPlc.Common
Overrides
OnCommLineStart(), OnCommLineTerminate(), InitDeviceTags(), Session(), SendCommand()
CmdLine / template
PollingOptions.CmdLine.Trim();
DeviceConfig properties referenced
| Property | Note |
|---|
| 未检测到 DeviceConfig.* 引用(可能使用基类封装)。 |
Line CustomOptions
| Key | Default |
|---|
RetryCount | — |
UseTagCache | — |
UseAutoAmsNetID | — |
AmsPort | — |
SenderAMSNetId | — |
TargetAMSNetId | — |
XML keys (Common)
| Node | Note |
|---|
| 未在 Common 中解析到 GetChildAs*/AppendElem 节点(或无 Common 工程)。 |
Code excerpt
87:
88: public override void InitDeviceTags()
89: {
90: string fileName = PollingOptions.CmdLine.Trim();
89: {
90: string fileName = PollingOptions.CmdLine.Trim();
91: deviceTemplate = new DeviceTemplate();
92: if (!deviceTemplate.Load(Storage, fileName, out string errMsg))
100: //初始化点位
101: plcDeviceSession.InitDeviceTags(DeviceTags, deviceTemplate);
102:
103: CanSendCommands = deviceTemplate.Cmds.Count > 0;
106: InitPlcConnection();
107: Log.WriteAction($"InitDeviceTags -> Line running");
108: }
109:
111:
112: public override void Session()
113: {
114: base.Session();
113: {
114: base.Session();
115: if (deviceTemplate == null)
116: {
Troubleshooting
- No data: line, address, template, connectivity.
- Template load errors: check logs.
- Options ignored: verify option scope (line vs device).