← Back to Docs

DrvModbusSlave Driver (Custom)

DrvModbusSlave communicator driver documentation.

Custom Communicator DriversVersion6.0.0Updated2026-04-29OwnerScadaV6CommExt

DrvModbusSlave Communicator Driver (Custom)

Functional Description

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

Scope and Version

  • Source: ScadaV6CommExt/DrvModbusSlave.Logic
  • TFM: net8.0
  • Version: 6.0.0

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

32: internal Dictionary dictionary;
46: private bool DataTimeout;
54: private delegate bool ReceiveRequestDelegate(Connection connection_0, out SlaveRequest request);
67: this.DataTimeout = false;
68: base.ConnectionRequired = false;
82: this.templateDict.dictionary = new Dictionary();
83: this.templateDict.scadaClient = new ScadaClient(base.CommContext.AppConfig.ConnectionOptions);
87: private DeviceTemplate GetDeviceTemplate(string fileName)
89: DeviceTemplate deviceTemplate = null;
96: if (this.templateDict.dictionary.TryGetValue(fileName, out DeviceTemplate existingTemplate))
103: DeviceTemplate newTemplate = new DeviceTemplate();
118: private void InitDeviceTemplate()
124: DeviceTemplate deviceTemplate = this.GetDeviceTemplate(this.modbusSlaveDeviceConfig.IndependentDeviceOptions.TemplateFileName);
134: DeviceTemplate deviceTemplate = this.GetDeviceTemplate(this.modbusSlaveDeviceConfig.DeviceGatewayOptions.TemplateFileName);
216: private bool ReceiveRtuRequest(Connection connection_0, out SlaveRequest slaveRequest)
218: int num = connection_0.Read(this.buffer, 0, 6, base.PollingOptions.Timeout, 0, out string logText);
226: int num5 = connection_0.Read(this.buffer, 6, num4, base.PollingOptions.Timeout, 0, out logText);
253: private bool ReceiveTcpRequest(Connection connection, out SlaveRequest request)
256: int num = connection.Read(this.buffer, 0, 7, base.PollingOptions.Timeout, 0, out text);
261: int num3 = connection.Read(this.buffer, 7, num2, base.PollingOptions.Timeout, 0, out text);
281: private void DecodeIncomingRequest(Connection connection, SlaveRequest slaveRequest, IncomingRequestArgs incomingRequestArgs)
519: OptionList customOptions = base.LineContext.LineConfig.CustomOptions;
520: this.transMode = ScadaUtils.GetValueAsEnum(customOptions, "TransMode", TransMode.RTU);
526: this.InitDeviceTemplate();
601: this.DataTimeout = true;

Administrator UI (DrvModbusSlave.View)

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

  • View source: ScadaV6CommExt/DrvModbusSlave.View
  • Main forms:
    • FrmChannelGatewayOptions.cs
    • FrmDeviceConfig.cs
Phrase keyText
ConfigDirRequiredThe device template file must be located inside {0}
lblTemplateFileNameDevice template
lblTemplateFileNameDevice template
thisDevice {0} Properties - Modbus Slave
IndependentDeviceDescriptionReceives data from Modbus Master.
DeviceGatewayDescriptionProvides data of the selected device to Modbus Master.
gbDeviceGatewayDevice Gateway Options
btnEditTemplateEdit
btnBrowseTemplateBrowse...
lblSourceDeviceNumData source device
lblAddressAddress
lblAddressHintDEC, starting from 0
gbIndependentDeviceIndependent Device Options
btnEditTemplateEdit
btnBrowseTemplateBrowse...
cbDevicesMode.Items[0]Independent device
cbDevicesMode.Items[1]Device gateway
cbDevicesMode.Items[2]Channel gateway
ChannelGatewayDescriptionProvides data of the selected channels to Modbus Master.
gbChannelGatewayChannel Gateway Options
btnEditEdit
btnSelectSelect
gbElemElement Parameters
lblChannelChannel
lblDataTypeData type
cbType.Items[0]Undefined
cbType.Items[1]ushort (2 bytes)
cbType.Items[2]short (2 bytes)
cbType.Items[3]uint (4 bytes)
cbType.Items[4]int (4 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/DrvModbusSlave.Logic
  • Common: n/a

Overrides

OnCommLineStart(), InitDeviceTags(), InitDeviceData(), BindDeviceTags(), Session(), SendCommand(), ReceiveIncomingRequest(), ProcessIncomingRequest()

CmdLine / template

未匹配到 PollingOptions.CmdLine 单行片段。

DeviceConfig properties referenced

PropertyNote
GeneralOptions源码中对 DeviceConfig 的引用
IndependentDeviceOptions源码中对 DeviceConfig 的引用
DeviceGatewayOptions源码中对 DeviceConfig 的引用
ChannelGatewayOptions源码中对 DeviceConfig 的引用
IsBound源码中对 DeviceConfig 的引用
Load源码中对 DeviceConfig 的引用
GetFileName源码中对 DeviceConfig 的引用

Line CustomOptions

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

XML keys (Common)

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

Code excerpt

84: 
85: 	private DeviceTemplate GetDeviceTemplate(string fileName)
86: 	{
87: 		DeviceTemplate deviceTemplate = null;

121: 			{
122: 				DeviceTemplate deviceTemplate = this.GetDeviceTemplate(this.modbusSlaveDeviceConfig.IndependentDeviceOptions.TemplateFileName);
123: 				if (deviceTemplate != null)
124: 				{

131: 			{
132: 				DeviceTemplate deviceTemplate = this.GetDeviceTemplate(this.modbusSlaveDeviceConfig.DeviceGatewayOptions.TemplateFileName);
133: 				if (deviceTemplate != null)
134: 				{

516: 	{
517: 		OptionList customOptions = base.LineContext.LineConfig.CustomOptions;
518: 		this.transMode = ScadaUtils.GetValueAsEnum(customOptions, "TransMode", TransMode.RTU);
519: 		this.InitLineData();

554: 
555: 	public override void InitDeviceTags()
556: 	{
557: 		this.InitElemsTags(this.elemGroupFactory.discreteInputsElemGroup);

592: 
593: 	public override void Session()
594: 	{
595: 		if (!this.DeviceError && this.modbusSlaveDeviceConfig.GeneralOptions.DeviceMode == DeviceMode.IndependentDevice && this.modbusSlaveDeviceConfig.IndependentDeviceOptions.DataLifetime > 0)

Troubleshooting

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