← Back to Docs

DrvVirtualDevice Driver (Custom)

DrvVirtualDevice communicator driver documentation.

Custom Communicator DriversVersion6.1.6Updated2026-04-29OwnerScadaV6CommExt

DrvVirtualDevice Communicator Driver (Custom)

Functional Description

DrvVirtualDevice is a custom Communicator driver in ScadaV6CommExt for field device connectivity. Protocol details follow the source implementation.

Scope and Version

  • Source: ScadaV6CommExt/DrvVirtualDevice.Logic
  • TFM: net8.0
  • Version: 6.1.6

Install and Enable

  1. Deploy driver binaries to Communicator folders.
  2. Activate driver in Administrator → Communicator → Drivers.
  3. Upload configuration and restart Communicator.

Line and Device Configuration

  1. Create a communication line with the proper channel type.
  2. Add device and set address/timeouts.
  3. 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)

KeyDefaultNote
RedisConn""Extracted from source; confirm meaning in driver implementation.

Code hints

25: DeviceTemplate deviceTemplate;
36: ConnectionRequired = false;
50: redisConn = LineContext.LineConfig.CustomOptions.GetValueAsString("RedisConn", "");
77: string fileName = PollingOptions.CmdLine.Trim();
78: deviceTemplate = new DeviceTemplate();

Administrator UI (DrvVirtualDevice.View)

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

  • View source: ScadaV6CommExt/DrvVirtualDevice.View
  • Main forms:
    • FrmDeviceProps.cs
    • FrmDeviceTemplate.cs
Phrase keyText
gbCmdCommand Parameters
lblCmdCodeCommand code
lblCmdNumCommand number
lblCmdAddressElement address
lblTemplateFileNameDevice template
ConfigDirRequiredThe device template file must be located inside {0}
TemplateNotExistsThe device template file does not exist.
btnAddCmd.ToolTipAdd Command
gbTemplateDevice Template
TemplateTitle{0} - Device Template Editor
DuplicatedCmdNumsDuplicated command numbers:
EmptyCmdCodesEmpty command codes found.
AddressHint{0}, starting from {1}
lblCmdNameName
lblCmdCodeWarnFill out code
lblCmdDataBlockData block
cbCmdDataBlock.Items[0]Coils (0X)
cbCmdDataBlock.Items[1]Holding Registers (4X)
cbCmdDataBlock.Items[2]Custom
chkCmdMultipleMultiple
lblCmdFuncCodeFunction code
lblCmdFuncCodeHexHexadecimal
lblCmdElemTypeElement 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)
cbCmdElemType.Items[6]long (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/DrvVirtualDevice.Logic
  • Common: DrvVirtualDevice.Common

Overrides

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

CmdLine / template

  • PollingOptions.CmdLine.Trim();

DeviceConfig properties referenced

PropertyNote
DeviceNum源码中对 DeviceConfig 的引用

Line CustomOptions

KeyDefault
RedisConn""

XML keys (Common)

NodeNote
Elem来自 Common 配置加载/保存相关源码中的 XML 节点名
ElemGroups来自 Common 配置加载/保存相关源码中的 XML 节点名
ElemGroup来自 Common 配置加载/保存相关源码中的 XML 节点名

Code excerpt

47:         {
48:             redisConn = LineContext.LineConfig.CustomOptions.GetValueAsString("RedisConn", "");
49:             InitRedisConn();
50:         }

72:         /// 
73:         public override void InitDeviceTags()
74:         {
75:             string fileName = PollingOptions.CmdLine.Trim();

74:         {
75:             string fileName = PollingOptions.CmdLine.Trim();
76:             deviceTemplate = new DeviceTemplate();
77:             if (!deviceTemplate.Load(Storage, fileName, out string errMsg))

131:         /// 
132:         public override void Session()
133:         {
134:             base.Session();

133:         {
134:             base.Session();
135: 
136:             if (deviceTemplate.ElemGroups.Count > 0 && redisService != null)

209:             FinishRequest();
210:             FinishSession();
211:         }
212: 

Troubleshooting

  • No data: line, address, template, connectivity.
  • Template load errors: check logs.
  • Options ignored: verify option scope (line vs device).