← Back to Docs

DrvIEC104 Driver (Custom)

DrvIEC104 communicator driver documentation.

Custom Communicator DriversVersion6.1.6Updated2026-04-29OwnerScadaV6CommExt

DrvIEC104 Communicator Driver (Custom)

Functional Description

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

Scope and Version

  • Source: ScadaV6CommExt/DrvIEC104.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
未在源码中匹配到明显的 GetValueAs* 调用,请在 Administrator 中打开该驱动的设备/线路配置界面逐项确认。

Code hints

33: protected class TemplateDict : Dictionary
46: private DeviceTemplate deviceTemplate;
51: private Connection mIEC104Con; // IEC104连接对象
69: var (hostName, port) = ParseConnectionAddress();
74: mIEC104Con = new Connection(hostName, port);
76: mIEC104Con.ConnectTimeout = 5000;
80: mIEC104Con.SetConnectionHandler(ConnectionHandler, null);
112: private (string hostName, int port) ParseConnectionAddress()
122: if (int.TryParse(address.Substring(colonIndex + 1), out int parsedPort))
124: port = parsedPort;
161: private void ConnectionHandler(object parameter, ConnectionEvent connectionEvent)
169: case ConnectionEvent.OPENED:
170: Log.WriteInfo("ConnectionHandler-> Connection opened successfully");
175: case ConnectionEvent.CLOSED:
176: Log.WriteInfo("ConnectionHandler-> Connection closed");
181: case ConnectionEvent.STARTDT_CON_RECEIVED:
182: Log.WriteInfo("ConnectionHandler-> STARTDT CON received");
185: case ConnectionEvent.STOPDT_CON_RECEIVED:
186: Log.WriteInfo("ConnectionHandler-> STOPDT CON received");
190: Log.WriteInfo($"ConnectionHandler-> Unknown event: {connectionEvent}");
196: Log.WriteError($"ConnectionHandler-> Exception: {ex.Message}");
267: ConnectionRequired = false; // 不使用默认连接池
501: int timeoutMs = mappedCmd.TimeoutMs > 0 ? mappedCmd.TimeoutMs : 5000;
607: int timeoutMs = mappedCmd.TimeoutMs > 0 ? mappedCmd.TimeoutMs : 5000;
633: Log.WriteWarning($"DownloadEntryWithRetry-> Timeout ioa={ioa} nof={nof} try={i}/{attempts}");

Administrator UI (DrvIEC104.View)

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

  • View source: ScadaV6CommExt/DrvIEC104.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?

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/DrvIEC104.Logic
  • Common: DrvIEC104.Common

Overrides

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

CmdLine / template

  • PollingOptions.CmdLine.Trim();

DeviceConfig properties referenced

PropertyNote
Name源码中对 DeviceConfig 的引用
StrAddress源码中对 DeviceConfig 的引用

Line CustomOptions

KeyDefault
未在 Logic 中检测到 CustomOptions.GetValueAs*(可能全部从设备模板 XML 读取)。

XML keys (Common)

NodeNote
Settings来自 Common 配置加载/保存相关源码中的 XML 节点名
ElemGroups来自 Common 配置加载/保存相关源码中的 XML 节点名
ElemGroup来自 Common 配置加载/保存相关源码中的 XML 节点名
Cmds来自 Common 配置加载/保存相关源码中的 XML 节点名
Cmd来自 Common 配置加载/保存相关源码中的 XML 节点名
ServerInterrogationInterval来自 Common 配置加载/保存相关源码中的 XML 节点名
ServerCommonAddress来自 Common 配置加载/保存相关源码中的 XML 节点名
ServerClockSync来自 Common 配置加载/保存相关源码中的 XML 节点名
Elem来自 Common 配置加载/保存相关源码中的 XML 节点名
AuthCode来自 Common 配置加载/保存相关源码中的 XML 节点名
AuthSett来自 Common 配置加载/保存相关源码中的 XML 节点名

Code excerpt

111:         {
112:             var address = DeviceConfig.StrAddress;
113:             var hostName = address;
114:             var port = 2404;

271:         #region 主要会话方法
272:         public override void Session()
273:         {
274:             base.Session();

273:         {
274:             base.Session();
275: 
276:             try

318: 
319:             FinishSession();
320:         }
321: 

1639:         #region 显示功能
1640:         public override void InitDeviceTags()
1641:         {
1642:             deviceTemplate = GetDeviceTemplate();

1641:         {
1642:             deviceTemplate = GetDeviceTemplate();
1643:             if (deviceTemplate == null) return;
1644:             // 配置读取公共地址和总召时间

Troubleshooting

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