//通讯驱动被关闭后120秒后重新再连接 public static void CDriverDll_CommunctionClose(IO_SERVER server, IO_COMMUNICATION comm, object tag) { var analysisTask = Task.Run(() => { AddLogToMainLog(comm.IO_COMM_NAME + "通讯通道已关闭!"); }); }
public IOCommunicationNode GetCommunicationNode(IO_SERVER server, IO_COMMUNICATION communication) { for (int i = 0; i < this.Nodes.Count; i++) { if (this.Nodes[i] is IOServerNode) { IOServerNode serNode = this.Nodes[i] as IOServerNode; if (serNode.Server == server) { for (int j = 0; j < serNode.Nodes.Count; j++) { if (serNode.Nodes[j] is IOCommunicationNode) { IOCommunicationNode commNode = serNode.Nodes[j] as IOCommunicationNode; if (commNode.Communication == communication) { return(commNode); } } } } } } return(null); }
protected void CommunctionContinueChanged(IO_SERVER server, object tag) { if (CommunctionContinue != null) { CommunctionContinue(server, IOCommunication, tag); } }
/// <summary> /// 报警生产的显示 /// </summary> /// <param name="server"></param> /// <param name="communication"></param> /// <param name="device"></param> /// <param name="alarm"></param> /// <param name="uploadresult"></param> public void InsertMonitorAlarmListView(IO_SERVER server, IO_COMMUNICATION communication, IO_DEVICE device, IO_PARAALARM alarm, string uploadresult) { if (IOMonitorManager.IsBackRun) { return; } if (uccbRealAlarm.Checked) { if (listViewAlarm.IsHandleCreated) { listViewAlarm.BeginInvoke(new EventHandler(delegate { ListViewItem lvi = new ListViewItem(alarm.IO_ALARM_ID); lvi.SubItems.Add(alarm.IO_ALARM_DATE); lvi.SubItems.Add(alarm.IO_NAME + "[" + alarm.IO_LABEL + "]"); lvi.SubItems.Add(alarm.IO_ALARM_VALUE); lvi.SubItems.Add(alarm.IO_ALARM_TYPE); lvi.SubItems.Add(alarm.IO_ALARM_LEVEL); lvi.SubItems.Add(server.SERVER_NAME); lvi.SubItems.Add(communication.IO_COMM_NAME + "[" + communication.IO_COMM_LABEL + "]"); lvi.SubItems.Add(device.IO_DEVICE_NAME + "[" + device.IO_DEVICE_LABLE + "]"); lvi.SubItems.Add(uploadresult); listViewAlarm.Items.Insert(0, lvi); if (listViewAlarm.Items.Count > int.Parse(this.ucLateAlarmSIze.SelectedValue)) { listViewAlarm.Items.RemoveAt(listViewAlarm.Items.Count - 1); } })); } } }
public void LoadProject() { Task.Run(() => { DataBaseFileName = Application.StartupPath + "\\IOProject\\IOCenterServer.station"; //设置数据库数据源 DbHelperSQLite.connectionString = "Data Source=" + DataBaseFileName; IO_SERVER serverBll = new IO_SERVER(); IO_COMMUNICATION commBll = new IO_COMMUNICATION(); IO_DEVICE deviceBll = new IO_DEVICE(); AddLog("初始化采集站数据......"); Servers = serverBll.GetModelList(""); AddLog("采集站数据已经完成!"); AddLog("加载通道数据......"); Communications = commBll.GetModelList(""); AddLog("通道数据已经完成!"); AddLog("加载设备及其IO点表......"); Devices = deviceBll.GetModelList(""); AddLog("加载设备及其IO点表已经完成"); for (int i = 0; i < Communications.Count; i++) { Communications[i].Devices = Devices.FindAll(x => x.IO_COMM_ID == Communications[i].IO_COMM_ID && x.IO_SERVER_ID == Communications[i].IO_SERVER_ID); } }); }
public void InitDevice(IO_SERVER server, IO_COMMUNICATION communication, IO_DEVICE device) { Device = device; Server = server; Communication = communication; SeriesIndex = -1; InitSeires(); InitListView(); if (Device != null) { //获取读取实时值 IOCenterManager.QueryFormManager.ReadRealDevice(this.Server, this.Communication, this.Device); TreeNode[] finders = this.hsComboBox.TreeView.Nodes.Find(Device.IO_DEVICE_ID, true); if (finders.Length > 0) { IoDeviceTreeNode node = finders[0] as IoDeviceTreeNode; this.hsComboBox.ShowItem(node); } realtimer.Interval = Device.IO_DEVICE_UPDATECYCLE * 1000; } if (Device != null) { realtimer.Interval = this.Device.IO_DEVICE_UPDATECYCLE * 1000; realtimer.Tick += Realtimer_Tick; realtimer.Start(); } }
/// <summary> /// 设置界面参数 /// </summary> /// <param name="para"></param> public virtual void SetUIParameter(IO_SERVER server, IO_DEVICE device, IO_PARA para) { Server = server; Device = device; Para = para; ParaString = para.IO_PARASTRING; }
public void InitDevice(IO_SERVER server, IO_COMMUNICATION communication, IO_DEVICE device) { InitSeriesListBox(device); Device = device; Server = server; Communication = communication; this.search.StartDate = DateTime.Now.AddDays(-10); this.search.EndDate = DateTime.Now; this.listBoxSeries.Items.Clear(); //此处只增加模拟量的IO点 for (int i = 0; i < Device.IOParas.Count; i++) { if (Device.IOParas[i].IO_POINTTYPE == "模拟量") { this.listBoxSeries.Items.Add(Device.IOParas[i]); } } if (Device != null) { ///设置下拉菜单选中项 this.search.SetSelectItem(this.Server, this.Communication, this.Device); ReadHistory(); } }
protected void CommunctionStopChanged(IO_SERVER server, object tag) { if (CommunctionStop != null) { CommunctionStop(server, IOCommunication, tag); } }
public IOServerNode(IO_SERVER mServer, string mProject) { Server = mServer; Project = mProject; mContextMenu = new ContextMenu(); mContextMenu.MenuItems.Add(new MenuItem("新建通道") { Tag = 1 }); mContextMenu.MenuItems.Add(new MenuItem("编辑采集站") { Tag = 2 }); mContextMenu.MenuItems.Add(new MenuItem("删除采集站工程") { Tag = 3 }); mContextMenu.MenuItems[0].Click += IOServerNode_Click; mContextMenu.MenuItems[1].Click += IOServerNode_Click; this.ContextMenu = mContextMenu; if (Server.SERVER_ID == null || Server.SERVER_ID == "") { Server.SERVER_IP = LocalIp.GetLocalIp(); Server.SERVER_ID = FormManager.ipToLong(Server.SERVER_IP); } this.Text = LocalIp.GetLocalIp(); ///当前加载工程的文件路径 this.Tag = Project; this.SelectedImageIndex = 0; this.StateImageIndex = 0; this.ImageIndex = 0; this.ExpandAll(); }
public override void SetUIParameter(IO_SERVER server, IO_DEVICE device) { try { this.ParaString = device.IO_DEVICE_PARASTRING; string[] strs = this.ParaString.Split(new char[2] { ':', ',' }); if (strs.Length == 4) { for (int i = 0; i < cbo_modbusType.Items.Count; i++) { if (cbo_modbusType.Items[i].ToString() == strs[1]) { cbo_modbusType.SelectedIndex = i; break; } } for (int i = 0; i < cbStored.Items.Count; i++) { if (cbStored.Items[i].ToString() == strs[3]) { cbStored.SelectedIndex = i; break; } } } } catch { } }
public void ChangedBinds(IO_SERVER server, IO_COMMUNICATION comm, IO_DEVICE device) { if (IOMonitorManager.IsBackRun) { return; } if (this.IsHandleCreated) { listView.BeginInvoke(new EventHandler(delegate { if (device != null) { ucRollText.Text = "IO路径: /" + server.SERVER_NAME + "/" + comm.IO_COMM_NAME + "[" + comm.IO_COMM_LABEL + "]/" + device.IO_DEVICE_NAME + "[" + device.IO_DEVICE_LABLE + "]"; this.listView.Items.Clear(); foreach (IO_PARA para in device.IOParas) { ListViewItem lvItem = new ListViewItem(para.IO_ID); lvItem.Text = para.IO_ID; lvItem.Tag = para; lvItem.SubItems.Add(para.IO_NAME); lvItem.SubItems.Add(para.IO_LABEL); lvItem.SubItems.Add(para.RealValue); lvItem.SubItems.Add(para.IO_UNIT); lvItem.SubItems.Add(para.RealDate); lvItem.SubItems.Add(para.RealQualityStamp.ToString()); lvItem.SubItems.Add(para.IO_POINTTYPE.ToString()); this.listView.Items.Add(lvItem); } } })); } }
public bool InitKernel(IO_SERVER server, IO_COMMUNICATION communication, IO_DEVICE device, IO_PARA para, SCADA_DEVICE_DRIVER driver) { try { this.ParaString = ""; this.DeviceParaString = ""; this.IOServer = server; this.IOCommunication = communication; this.IODevice = device; this.Driver = driver; if (para != null) { this.ParaString = para.IO_PARASTRING; } if (device != null) { this.DeviceParaString = device.IO_DEVICE_PARASTRING; } return(InitDeviceKernel(server, communication, device, para, driver)); } catch { return(false); } }
private void ucBtn_Search_BtnClick(object sender, EventArgs e) { if (hsComboBoxDevices.SelectedItem == null) { FrmDialog.ShowDialog(this, "请选择要查询历史数据的设备节点!", "提示"); return; } if (dateStart.Value > dateEnd.Value) { FrmDialog.ShowDialog(this, "开始时间必须小于结束时间!", "提示"); return; } if ((dateEnd.Value - dateStart.Value).Days >= 31) { FrmDialog.ShowDialog(this, "您选择的时间段太长,时间段不能超过31天!", "提示"); return; } IoDeviceTreeNode node = hsComboBoxDevices.SelectedItem as IoDeviceTreeNode; if (SearchClick != null) { this.Server = ((IoServerTreeNode)node.Parent.Parent).Server; this.Communication = ((IoCommunicationTreeNode)node.Parent).Communication; SearchClick(node.Device, e); } }
/// <summary> /// 发送数据完成的事件 /// </summary> /// <param name="server"></param> /// <param name="device"></param> /// <param name="para"></param> /// <param name="value"></param> protected void DataSended(IO_SERVER server, IO_COMMUNICATION comm, IO_DEVICE device, IO_PARA para, string value, bool result) { if (DeviceSended != null) { DeviceSended(server, comm, device, para, value, result); } }
public void CloseForm() { Server = null; Communication = null; Device = null; this.DialogResult = DialogResult.Cancel; }
private void btnCancel_BtnClick(object sender, EventArgs e) { Server = null; Communication = null; Device = null; this.DialogResult = DialogResult.Cancel; }
protected override bool InitCommunicateKernel(IO_SERVER server, IO_COMMUNICATION communication, List <IO_DEVICE> ioDevices, SCADA_DRIVER driver) { if (IsCreateControl) { CommunicationControl = new Modbus_Serial_Ctrl(); if (communication != null) { CommunicationControl.SetUIParameter(communication.IO_COMM_PARASTRING); } } Serial_PARA = new Modbus_Serial_PARA(); if (communication != null) { comParaPack = new ParaPack(communication.IO_COMM_PARASTRING); Serial_PARA.BaudRate = Convert.ToInt32(comParaPack.GetValue("波特率")); Serial_PARA.CollectFaultsInternal = Convert.ToInt32(comParaPack.GetValue("重试间隔")); Serial_PARA.CollectFaultsNumber = Convert.ToInt32(comParaPack.GetValue("重试次数")); Serial_PARA.ContinueCollect = comParaPack.GetValue("连续采集") == "1" ? true : false; Serial_PARA.DataBits = Convert.ToInt32(comParaPack.GetValue("数据位")); Serial_PARA.ModbusType = (ModbusType)Enum.Parse(typeof(ModbusType), comParaPack.GetValue("MODBUS类型")); Serial_PARA.OffsetInterval = Convert.ToInt32(comParaPack.GetValue("偏移间隔")); Serial_PARA.PackMaxSize = Convert.ToInt32(comParaPack.GetValue("包最大长度")); Serial_PARA.ReadTimeout = Convert.ToInt32(comParaPack.GetValue("读超时时间")); Serial_PARA.RSTSendPreKeeyTime = Convert.ToInt32(comParaPack.GetValue("发送前RTS保持时间")); Serial_PARA.RTSSendAfterKeeyTime = Convert.ToInt32(comParaPack.GetValue("发送后RTS保持时间")); Serial_PARA.RTSEnable = comParaPack.GetValue("RTS") == "1" ? true : false; Serial_PARA.SerialCheck = (SerialCheck)Enum.Parse(typeof(SerialCheck), comParaPack.GetValue("校验")); Serial_PARA.SerialPort = comParaPack.GetValue("串口"); Serial_PARA.SimulatorSerialPort = comParaPack.GetValue("模拟器串口"); Serial_PARA.SixCommmand = comParaPack.GetValue("支持6号命令") == "1" ? true : false; Serial_PARA.SixteenCommmand = comParaPack.GetValue("支持16号命令") == "1" ? true : false;; Serial_PARA.StopBits = (StopBits)Enum.Parse(typeof(StopBits), comParaPack.GetValue("停止位")); Serial_PARA.WriteTimeout = Convert.ToInt32(comParaPack.GetValue("写超时时间")); //构造获取数据命令的字节数组,Modbus for (int i = 0; i < this.IODevices.Count; i++) { object fragment = new ModbusFragmentStore(); RealData mRealData = new RealData(); mRealData.Device = this.IODevices[i]; ScadaDeviceKernel driverDll = DeviceDrives.Find(x => x.DeviceDriverID == this.IODevices[i].DEVICE_DRIVER_ID); if (driverDll != null) { driverDll.InitKernel(IOServer, IOCommunication, this.IODevices[i], null, this.IODevices[i].DriverInfo); //IO_DEVICE_ADDRESS中存储的是DTU编号 mRealData.SlaveId = this.IODevices[i].IO_DEVICE_ADDRESS; //数据库中系统编号 mRealData.DEVICEID = this.IODevices[i].IO_DEVICE_ID; //获取下发命令的参数,注意此次要进心分段存储,因为modbus一次不能超过123个寄存器地址 mRealData.Fragment = (ModbusFragmentStore)fragment; RealDevices.Add(mRealData); } } } return(true); }
/// <summary> /// /// </summary> /// <param name="server"></param> /// <param name="comm"></param> /// <param name="device"></param> /// <param name="receivedatas">接收的数据的字节</param> /// <param name="date">接收数据的日期</param> /// <param name="sender">接收数据的其它限定参数</param> protected void ReceiveData(IO_SERVER server, IO_COMMUNICATION comm, IO_DEVICE device, byte[] receivedatas, string date, object sender = null) { Task.Run(() => { if (OnDataReceived != null) { OnDataReceived(server, comm, device, receivedatas, date, sender); } }); }
/// <summary> /// 设备通讯状态变化的时候修改对应的界面显示效果,树结构中的参数 /// </summary> /// <param name="server"></param> /// <param name="device"></param> /// <param name="para"></param> /// <param name="tag"></param> protected void DeviceStatus(IO_SERVER server, IO_COMMUNICATION comm, IO_DEVICE device, IO_PARA para, object tag) { if (device != null) { if (DeviceStatusChanged != null) { DeviceStatusChanged(server, comm, device, para, tag); } } }
//由于此处Para里面设置的可能是不同命令的IO参数,所以需要返回不同命令的实时获取的数据,此处不需要返回Byte字节数组 public List <byte[]> GetDataCommandBytes(IO_SERVER server, IO_COMMUNICATION Communication, IO_DEVICE device, List <IO_PARA> paras, IO_PARA currentpara, ref object sender) { List <byte[]> cmmdBytes = new List <byte[]>(); //必须Read的IO参数 List <ModbusFragmentStore> modbusCodes = new List <ModbusFragmentStore>(); for (int i = 0; i < paras.Count; i++) { ParaPack paraPack = new ParaPack(paras[i].IO_PARASTRING); if (!modbusCodes.Exists(x => x.StoredCode == paraPack.GetValue("内存区")) && paraPack.GetValue("内存区") != "") { ModbusFragmentStore stored = new ModbusFragmentStore(); stored.StoredCode = paraPack.GetValue("内存区"); stored.Fragments = new List <ModbusFragment>(); stored.Units = new List <ushort>(); modbusCodes.Add(stored); } paraPack.Dispose(); paraPack = null; } for (int i = 0; i < paras.Count; i++) { ParaPack paraPack = new ParaPack(paras[i].IO_PARASTRING); if (paraPack.GetValue("内存区") != "") { if (modbusCodes.Exists(x => x.StoredCode == paraPack.GetValue("内存区")) && paraPack.GetValue("内存区") != "") { ModbusFragmentStore stored = modbusCodes.Find(x => x.StoredCode == paraPack.GetValue("内存区")); if (paraPack.GetValue("偏置") != "") { ushort offset = 0; if (ushort.TryParse(paraPack.GetValue("偏置"), out offset)) { if (!stored.Units.Contains(offset)) { stored.Units.Add(offset); } } } } } } ModbusFragmentStore mainStored = new ModbusFragmentStore(); //由于modbus获取寄存器最大数量是124个,所以要进行分段,最大线圈数量是1999个 foreach (ModbusFragmentStore stored in modbusCodes) { stored.MakeFragment(); mainStored.Fragments.AddRange(stored.Fragments); } //获取要解析的命令 sender = mainStored; return(cmmdBytes); }
protected virtual bool InitCommunicateKernel(IO_SERVER server, IO_COMMUNICATION communication, List <IO_DEVICE> ioDevices, SCADA_DRIVER driver) { try { return(true); } catch { return(false); } }
public void SetSelectItem(IO_SERVER server, IO_COMMUNICATION communication, IO_DEVICE device) { Device = device; Communication = communication; Server = server; TreeNode[] finders = this.hsComboBoxDevices.TreeView.Nodes.Find(device.IO_DEVICE_ID, true); if (finders.Length > 0) { IoDeviceTreeNode node = finders[0] as IoDeviceTreeNode; this.hsComboBoxDevices.ShowItem(node); } }
protected override bool InitCommunicateKernel(IO_SERVER server, IO_COMMUNICATION communication, List <IO_DEVICE> ioDevices, SCADA_DRIVER driver) { if (IsCreateControl) { CommunicationControl = new Modbus_UDP_Ctrl(); if (communication != null) { CommunicationControl.SetUIParameter(communication.IO_COMM_PARASTRING); } } Udp_PARA = new Modbus_TCP_PARA(); if (communication != null) { TcpParaPack = new ParaPack(communication.IO_COMM_PARASTRING); Udp_PARA.CollectFaultsInternal = Convert.ToInt32(TcpParaPack.GetValue("重试间隔")); Udp_PARA.CollectFaultsNumber = Convert.ToInt32(TcpParaPack.GetValue("重试次数")); Udp_PARA.ContinueCollect = TcpParaPack.GetValue("重试") == "1" ? true : false; Udp_PARA.LocalTCP_Port = TcpParaPack.GetValue("本地端口"); Udp_PARA.LocalTCP_IP = TcpParaPack.GetValue("本地IP"); Udp_PARA.SimulatorTCP_Port = TcpParaPack.GetValue("模拟设备端口"); Udp_PARA.SimulatorTCP_IP = TcpParaPack.GetValue("模拟设备IP"); Udp_PARA.WriteTimeout = int.Parse(TcpParaPack.GetValue("写超时时间")); Udp_PARA.ReadTimeout = int.Parse(TcpParaPack.GetValue("读超时时间")); Udp_PARA.WriteBufferSize = int.Parse(TcpParaPack.GetValue("写缓存")); Udp_PARA.ReadBufferSize = int.Parse(TcpParaPack.GetValue("读缓存")); //构造获取数据命令的字节数组,Modbus for (int i = 0; i < this.IODevices.Count; i++) { object fragment = new ModbusFragmentStore(); RealData mRealData = new RealData(); mRealData.Device = this.IODevices[i]; ScadaDeviceKernel driverDll = DeviceDrives.Find(x => x.DeviceDriverID == this.IODevices[i].DEVICE_DRIVER_ID); if (driverDll != null) { driverDll.InitKernel(IOServer, IOCommunication, this.IODevices[i], null, this.IODevices[i].DriverInfo); //IO_DEVICE_ADDRESS中存储的是DTU编号 mRealData.SlaveId = this.IODevices[i].IO_DEVICE_ADDRESS; //数据库中系统编号 mRealData.DEVICEID = this.IODevices[i].IO_DEVICE_ID; //获取下发命令的参数,注意此次要进心分段存储,因为modbus一次不能超过123个寄存器地址 //mRealData.ReadSendByte = driverDll.GetDataCommandBytes(this.IOServer, this.IOCommunication, this.IODevices[i], this.IODevices[i].IOParas, null, ref fragment); } mRealData.Fragment = (ModbusFragmentStore)fragment; RealDevices.Add(mRealData); } } return(true); }
public override void SetUIParameter(IO_SERVER server, IO_DEVICE device, IO_PARA para) { base.SetUIParameter(server, device, para); if (para.IO_PARASTRING != null && para.IO_PARASTRING != "") { ParaPack paraPack = new ParaPack(para.IO_PARASTRING); paraPack.SetCtrlValue(tb_JsonName, paraPack.GetValue("IO标识")); paraPack.SetCtrlValue(nudTime, paraPack.GetValue("时间值索引")); paraPack.SetCtrlValue(cbDataType, paraPack.GetValue("数据类型")); paraPack.SetCtrlValue(nud_valueIndex, paraPack.GetValue("采集值索引")); paraPack.SetCtrlValue(tbCmdValue, paraPack.GetValue("命令默认值")); } this.ParaString = para.IO_PARASTRING; }
/// <summary> /// 本通讯通道内设备发送数据后返回的事件 /// </summary> /// <param name="server"></param> /// <param name="comm"></param> /// <param name="device"></param> /// <param name="para"></param> /// <param name="value"></param> /// <param name="result"></param> public static void CDriverDll_DeviceSended(IO_SERVER server, IO_COMMUNICATION comm, IO_DEVICE device, IO_PARA para, string value, bool result) { var analysisTask = Task.Run(() => { if (result) { AddLogToMainLog("下置" + device.IO_DEVICE_NAME + "设备" + para.IO_NAME + "IO点值" + value + "成功!"); } else { AddLogToMainLog("下置" + device.IO_DEVICE_NAME + "设备" + para.IO_NAME + "IO点值" + value + "失败!"); } }); }
/// <summary> /// 初始化驱动 /// </summary> /// <param name="server"></param> /// <param name="communication"></param> /// <param name="ioDevices"></param> /// <param name="driver"></param> /// <returns></returns> protected override bool InitCommunicateKernel(IO_SERVER server, IO_COMMUNICATION communication, List <IO_DEVICE> ioDevices, SCADA_DRIVER driver) { try { ParaPack communicatePack = new ParaPack(communication.IO_COMM_PARASTRING); if (communication.IO_COMM_PARASTRING != null && communication.IO_COMM_PARASTRING != "") { this.ServerIP = communicatePack.GetValue("服务器IP"); this.ServerPort = int.Parse(communicatePack.GetValue("端口号")); this.UserName = communicatePack.GetValue("用户名"); this.Password = communicatePack.GetValue("密码"); this.EaableAnonymousAuthentication = bool.Parse(communicatePack.GetValue("开启匿名验证")); this.HeartTime = int.Parse(communicatePack.GetValue("心跳时间")); string msgqulity = communicatePack.GetValue("消息质量"); switch (msgqulity) { case "QoS 0 最多分发一次": MessageQulity = MqttQualityOfServiceLevel.AtMostOnce; break; case "QoS 1 至少分发一次": MessageQulity = MqttQualityOfServiceLevel.AtLeastOnce; break; case "QoS 2 只分发一次": MessageQulity = MqttQualityOfServiceLevel.ExactlyOnce; break; } this.WillFlag = communicatePack.GetValue("遗愿标志"); this.MqttDataType = communicatePack.GetValue("数据格式"); this.EaableClientIDAuthentication = bool.Parse(communicatePack.GetValue("开启Mqtt客户端识别")); } if (IsCreateControl) { CommunicationControl = new MQTTServerCtrl(); if (communication != null && communication.IO_COMM_PARASTRING != "") { CommunicationControl.SetUIParameter(communication.IO_COMM_PARASTRING); } } } catch (Exception emx) { this.DeviceException(emx.Message); return(false); } return(true); }
public override void SetUIParameter(IO_SERVER server, IO_DEVICE device) { ParaPack paraPack = new ParaPack(device.IO_DEVICE_PARASTRING); paraPack.SetCtrlValue(tbIdentification, paraPack.GetValue("注册标识")); paraPack.SetCtrlValue(txtAddress, device.IO_DEVICE_ADDRESS); paraPack.SetCtrlValue(cbModbusType, paraPack.GetValue("Modbus类型")); paraPack.SetCtrlValue(nbReadTimeout, paraPack.GetValue("读超时")); paraPack.SetCtrlValue(nbWriteTimeout, paraPack.GetValue("写超时")); paraPack.SetCtrlValue(ndReadBuffSize, paraPack.GetValue("读缓存")); paraPack.SetCtrlValue(ndWriteBufferSize, paraPack.GetValue("写缓存")); paraPack.SetCtrlValue(cbRetries, paraPack.GetValue("失败重试")); paraPack.SetCtrlValue(ndRetiresNum, paraPack.GetValue("重试次数")); paraPack.SetCtrlValue(nbRetiresInternal, paraPack.GetValue("重试间隔")); }
public IOServerNode GetServerNode(IO_SERVER server) { for (int i = 0; i < this.Nodes.Count; i++) { if (this.Nodes[i] is IOServerNode) { IOServerNode serNode = this.Nodes[i] as IOServerNode; if (serNode.Server == server) { return(serNode); } } } return(null); }
public override bool InitDriver(IO_SERVER server, IO_COMMUNICATION communication, List <IO_DEVICE> ioDevices, SCADA_DRIVER driver) { try { base.InitDriver(server, communication, ioDevices, driver); if (IsCreateControl) { CommunicationControl = new Modbus_TCP_Network_Bridge_Ctrl(); } } catch { return(false); } return(true); }