DrvSiemensS7Plus Communicator Driver (Custom)
Functional Description
DrvSiemensS7Plus is a custom Communicator driver in ScadaV6CommExt for field device connectivity. Protocol details follow the source implementation.
Scope and Version
- Source:
ScadaV6CommExt/DrvSiemensS7Plus.Logic - TFM:
net8.0 - Version:
6.2.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 |
|---|
未在源码中匹配到明显的 GetValueAs* 调用,请在 Administrator 中打开该驱动的设备/线路配置界面逐项确认。 |
Code hints
22: protected DeviceTemplate deviceTemplate;
31: ConnectionRequired = false; //不使用默认连接池
249: var ipPort = deviceAddr.Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries);
250: siemensS7Net = new SiemensS7NetPlus(ipPort[0].Trim(), int.Parse(ipPort[1]));
277: string fileName = PollingOptions.CmdLine.Trim();
336: deviceTemplate = DriverUtils.TemplateFactory.CreateDeviceTemplate();
Administrator UI (DrvSiemensS7Plus.View)
Configure in Administrator → Communicator. Labels below come from the View language pack.
- View source:
ScadaV6CommExt/DrvSiemensS7Plus.View - Main forms:
| Phrase key | Text |
|---|
this | SiemensS7-Plus. Device Template Editor |
btnAddCmd.ToolTip | Add command |
gbDevTemplate | Device template |
gbCmd | Command parameters |
lblCmdAddress | Element address |
lblCmdNum | Command number |
CmdsNode | Commands |
DefCmdName | |
lblDeviceAddr | Device Address |
lblDevTemplate | Device template |
TemplNotExists | The device template file does not exist. |
btnNew.ToolTip | Create new template |
btnOpen.ToolTip | Open template |
btnSave.ToolTip | Save template |
btnSaveAs.ToolTip | Save template as |
btnEditSettings.ToolTip | Edit template settings |
lblGrAddress | Start element address |
lblElemAddress | Address |
lblCmdName | Name |
lblCmdTableType | Data table |
cbCmdTableType.Items[0] | Coils (0X) |
cbCmdTableType.Items[1] | Holding Registers (4X) |
lblCmdFuncCode | Function code |
lblCmdElemType | Element type |
cbCmdElemType.Items[0] | Undefined |
cbCmdElemType.Items[1] | ushort (2 bytes) |
cbCmdElemType.Items[2] | short (2 bytes) |
cbCmdElemType.Items[3] | uint (4 bytes) |
cbCmdElemType.Items[4] | int (4 bytes) |
cbCmdElemType.Items[5] | ulong (8 bytes) |
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/DrvSiemensS7Plus.Logic- Common:
DrvSiemensS7Plus.Common
Overrides
Session(), SendCommand(), OnCommLineStart(), OnCommLineTerminate(), InitDeviceTags()
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 |
|---|
Elem | 来自 Common 配置加载/保存相关源码中的 XML 节点名 |
DeviceType | 来自 Common 配置加载/保存相关源码中的 XML 节点名 |
Rack | 来自 Common 配置加载/保存相关源码中的 XML 节点名 |
Slot | 来自 Common 配置加载/保存相关源码中的 XML 节点名 |
ReconnectionTime | 来自 Common 配置加载/保存相关源码中的 XML 节点名 |
Settings | 来自 Common 配置加载/保存相关源码中的 XML 节点名 |
ElemGroups | 来自 Common 配置加载/保存相关源码中的 XML 节点名 |
ElemGroup | 来自 Common 配置加载/保存相关源码中的 XML 节点名 |
Cmds | 来自 Common 配置加载/保存相关源码中的 XML 节点名 |
Cmd | 来自 Common 配置加载/保存相关源码中的 XML 节点名 |
Code excerpt
32:
33: public override void Session()
34: {
35: base.Session();
34: {
35: base.Session();
36: if (deviceTemplate == null)
37: {
142: // 统计计算
143: FinishSession();
144: }
145:
240: {
241: var deviceAddr = DeviceConfig.StrAddress;
242: var slot = deviceTemplate.Sett.Slot;
243: ExecWriteToLog($"StartPlcConn: deviceAddr:{deviceAddr}, slot: {slot}");
271: ///
272: public override void InitDeviceTags()
273: {
274: // PrepareAuthTemplate();
274: // PrepareAuthTemplate();
275: string fileName = PollingOptions.CmdLine.Trim();
276: PrepareTemplate(fileName);
277: int tagInd = 0;
Troubleshooting
- No data: line, address, template, connectivity.
- Template load errors: check logs.
- Options ignored: verify option scope (line vs device).