DrvWeihenstephan Communicator Driver (Custom)
Functional Description
DrvWeihenstephan is a custom Communicator driver in ScadaV6CommExt for field device connectivity. Protocol details follow the source implementation.
Scope and Version
- Source:
ScadaV6CommExt/DrvWeihenstephan.Logic - TFM:
net8.0 - Version:
6.1.6
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 |
|---|
未在源码中匹配到明显的 GetValueAs* 调用,请在 Administrator 中打开该驱动的设备/线路配置界面逐项确认。 |
Code hints
23: protected class TemplateDict : Dictionary
33: ConnectionRequired = false; //不使用默认连接池
37: private DeviceTemplate devTemplate = null;
42: private int readTimeout = 1000;
62: devTemplate = new DeviceTemplate();
63: string fileName = PollingOptions.CmdLine.Trim();
138: .SetRemoteIPHost(new IPHost(DeviceConfig.StrAddress.Trim()))
Administrator UI (DrvWeihenstephan.View)
Configure in Administrator → Communicator. Labels below come from the View language pack.
- View source:
ScadaV6CommExt/DrvWeihenstephan.View - Main forms:
FrmDeviceProps.csFrmDeviceTemplate.csFrmTemplateOptions.cs
| 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 | {0} - 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/DrvWeihenstephan.Logic- Common:
DrvWeihenstephan.Common
Overrides
OnCommLineStart(), OnCommLineTerminate(), InitDeviceTags(), Session(), SendCommand()
CmdLine / template
PollingOptions.CmdLine.Trim();
DeviceConfig properties referenced
| Property | Note |
|---|
StrAddress | 源码中对 DeviceConfig 的引用 |
Line CustomOptions
| Key | Default |
|---|
| 未在 Logic 中检测到 CustomOptions.GetValueAs*(可能全部从设备模板 XML 读取)。 |
XML keys (Common)
| Node | Note |
|---|
Options | 来自 Common 配置加载/保存相关源码中的 XML 节点名 |
ElemGroups | 来自 Common 配置加载/保存相关源码中的 XML 节点名 |
ElemGroup | 来自 Common 配置加载/保存相关源码中的 XML 节点名 |
Elem | 来自 Common 配置加载/保存相关源码中的 XML 节点名 |
Code excerpt
57:
58: public override void InitDeviceTags()
59: {
60: devTemplate = new DeviceTemplate();
60: devTemplate = new DeviceTemplate();
61: string fileName = PollingOptions.CmdLine.Trim();
62: if (string.IsNullOrEmpty(fileName)) { Log.WriteLine($"Error: Template is undefined for the {base.Title}"); return; }
63: if (!devTemplate.Load(Storage, fileName, out string errMsg)) { Log.WriteLine(errMsg); return; }
131:
132: Log.WriteLine($"WS server addr:{DeviceConfig.StrAddress}");
133:
134: //载入配置
135: tcpClient.Setup(new TouchSocketConfig()
136: .SetRemoteIPHost(new IPHost(DeviceConfig.StrAddress.Trim()))
137: .ConfigurePlugins(a =>
138: {
271:
272: public override void Session()
273: {
274: base.Session();
273: {
274: base.Session();
275:
276: if (FirstConnectSuccess == false)
Troubleshooting
- No data: line, address, template, connectivity.
- Template load errors: check logs.
- Options ignored: verify option scope (line vs device).