← 返回文档中心

DrvBrPvi 通信驱动(自研)

DrvBrPvi 自研通信驱动文档。

自研通信驱动适用版本6.0.0更新时间2026-04-29负责人ScadaV6CommExt

DrvBrPvi 通信驱动(自研)

功能描述

DrvBrPvi 为 ScadaV6CommExt 中的自研 Communicator 驱动,用于与现场设备或系统进行数据采集与命令交互。具体协议与能力以源码实现为准。

适用范围与版本

  • 源码目录:ScadaV6CommExt/DrvBrPvi.Logic
  • 目标框架:net8.0
  • 程序集版本:6.0.0

安装与启用

  1. 按 RapidSCADA 标准流程将驱动 DLL 部署到 Communicator 安装目录(保持目录层级)。
  2. 在 Administrator 中打开项目 → Communicator → 驱动程序,确认驱动已出现在可用列表并激活。
  3. 上传配置到服务器并重启 Communicator 服务。

线路与设备配置(使用步骤)

  1. Communicator → 通信线路 中新建线路,选择与本驱动匹配的通道类型(串口 / TCP / UDP 等,以界面为准)。
  2. 在线路下添加设备,填写设备地址、超时、重试等通用参数。
  3. 在设备 轮询选项 中填写 命令行(CmdLine) 及本驱动所需的其它选项;CmdLine 在本驱动中的含义(通常为模板文件名)、设备地址格式及线路级参数请对照下文 功能依据与配置要点(模板与源码) 与「线路 CustomOptions」小节。
  4. 保存项目并上传配置,观察 Communicator 日志与设备状态。

线路 CustomOptions 参数(源码提取)

下表由源码正则提取,供快速对照;最终以实际配置界面与注释为准。

参数键默认值/片段说明
Username源码中提取的 CustomOptions 键,具体含义以驱动实现为准。
Password源码中提取的 CustomOptions 键,具体含义以驱动实现为准。
PviDllPath源码中提取的 CustomOptions 键,具体含义以驱动实现为准。
Timeout3000源码中提取的 CustomOptions 键,具体含义以驱动实现为准。
Arsimfalse源码中提取的 CustomOptions 键,具体含义以驱动实现为准。
RetryCount10源码中提取的 CustomOptions 键,具体含义以驱动实现为准。

配置相关源码片段(参考)

16: protected DeviceTemplate deviceTemplate;
25: ConnectionRequired = false;
45: string fileName = PollingOptions.CmdLine.Trim();
46: deviceTemplate = new DeviceTemplate();
60: string username = LineContext.LineConfig.CustomOptions.GetValueAsString("Username");
61: string password = LineContext.LineConfig.CustomOptions.GetValueAsString("Password");
62: string pviDllPath = LineContext.LineConfig.CustomOptions.GetValueAsString("PviDllPath");
63: int timeout = LineContext.LineConfig.CustomOptions.GetValueAsInt("Timeout", 3000);
64: bool arsim = LineContext.LineConfig.CustomOptions.GetValueAsBool("Arsim", false);
65: retryCount = Math.Max(1, LineContext.LineConfig.CustomOptions.GetValueAsInt("RetryCount", 10));
211: string[] keys = { "Host", "Ip", "IP", "IPAddress", "TargetIP" };
214: string val = LineContext.LineConfig.CustomOptions.GetValueAsString(key)?.Trim() ?? string.Empty;

Administrator UI (Drv[内部驱动].View)

Configure in Administrator → Communicator. Labels below come from the View language pack.

  • View source: ScadaV6CommExt/Drv[内部驱动].View
  • Main forms:
    • FrmAuthSetting.cs
    • FrmDeviceProps.cs
    • FrmDeviceTemplate.cs
    • FrmTemplateSettings.cs
Phrase keyText
thisIEC104. Device Template Editor
btnAddCmd.ToolTipAdd command
gbDevTemplateDevice template
gbCmdCommand parameters
lblCmdAddressElement address
lblCmdNumCommand number
CmdsNodeCommands
DefCmdName
lblDevTemplateDevice template
TemplNotExistsThe device template file does not exist.
btnNew.ToolTipCreate new template
btnOpen.ToolTipOpen template
btnSave.ToolTipSave template
btnSaveAs.ToolTipSave template as
btnEditSettings.ToolTipEdit template settings
lblGrAddressStart element address
lblElemAddressAddress
lblCmdNameName
lblCmdTableTypeData table
cbCmdTableType.Items[0]归一化遥测值 (NVA)
cbCmdTableType.Items[1]标度化值(SVA)
cbCmdTableType.Items[2]短浮点数(Float)
chkCmdMultipleMultiple
lblCmdFuncCodeFunction code
lblCmdElemTypeElement type
lblCmdElemCntElement count
lblCmdByteOrderByte order
lblCmdByteOrderExampleFor example, 01234567
AddressHint{0}, starting from {1}
SaveTemplateConfirmTemplate has been modified. Save the changes?

管理端配置界面

未在仓库中找到与 DrvBrPvi 匹配的 Drv*.View 工程,请在 Administrator 中打开该驱动的设备/线路属性窗口,以实际界面为准。

功能依据与配置要点(模板与源码)

下列要点依据仓库内 Logic / Common 及设备模板 XML 归纳,用于说明本驱动的行为以及在 Administrator / Communicator 中需要配置的项(设备地址、CmdLine、线路 CustomOptions、模板 XML 节点等)。

逻辑入口

  • Logic 目录:ScadaV6CommExt/DrvBrPvi.Logic
  • Common 目录:ScadaV6CommExt/DrvBrPvi.Common

重写的关键方法

OnCommLineStart(), OnCommLineTerminate(), InitDeviceTags(), Session(), SendCommand()

设备模板 / CmdLine

  • PollingOptions.CmdLine.Trim();

DeviceConfig 字段引用(源码中出现)

属性说明
未检测到 DeviceConfig.* 引用(可能使用基类封装)。

线路 CustomOptions(GetValueAs*)

参数键默认值/片段
Username
Password
PviDllPath
Timeout3000
Arsimfalse
RetryCount10

模板/配置 XML 节点(Common 提取)

XML 节点备注
未在 Common 中解析到 GetChildAs*/AppendElem 节点(或无 Common 工程)。

关键源码片段(节选)

40: 
41:         public override void InitDeviceTags()
42:         {
43:             string fileName = PollingOptions.CmdLine.Trim();

42:         {
43:             string fileName = PollingOptions.CmdLine.Trim();
44:             deviceTemplate = new DeviceTemplate();
45: 

53:             driverCommonLib.InitCommandMaps(deviceTemplate);
54:             driverCommonLib.InitDeviceTags(DeviceTags, deviceTemplate);
55:             CanSendCommands = deviceTemplate.Cmds.Count > 0;
56: 

57:             string host = ResolveHost();
58:             string username = LineContext.LineConfig.CustomOptions.GetValueAsString("Username");
59:             string password = LineContext.LineConfig.CustomOptions.GetValueAsString("Password");
60:             string pviDllPath = LineContext.LineConfig.CustomOptions.GetValueAsString("PviDllPath");

58:             string username = LineContext.LineConfig.CustomOptions.GetValueAsString("Username");
59:             string password = LineContext.LineConfig.CustomOptions.GetValueAsString("Password");
60:             string pviDllPath = LineContext.LineConfig.CustomOptions.GetValueAsString("PviDllPath");
61:             int timeout = LineContext.LineConfig.CustomOptions.GetValueAsInt("Timeout", 3000);

59:             string password = LineContext.LineConfig.CustomOptions.GetValueAsString("Password");
60:             string pviDllPath = LineContext.LineConfig.CustomOptions.GetValueAsString("PviDllPath");
61:             int timeout = LineContext.LineConfig.CustomOptions.GetValueAsInt("Timeout", 3000);
62:             bool arsim = LineContext.LineConfig.CustomOptions.GetValueAsBool("Arsim", false);

排障

  • 设备无数据:检查线路通道、地址、模板文件、网络/串口连通性。
  • 模板加载失败:查看 Communicator 日志中 Device template / Load template 相关错误。
  • 参数不生效:确认 CustomOptions 是否写在线路或设备正确层级(以驱动读取位置为准)。