float Force; //存储上一次力值,避免 丰仪仪表不准确的情况发生 /// <summary> /// 开始采集 /// </summary> /// <param name="ControllerOrder"></param> public void StartAcquisition() { if (rfpcomm == null) { rfpcomm = new FyComm(); rfpcomm.OnAddItem += new IFyCommEvents_OnAddItemEventHandler(rfpcomm_OnAddItem); rfpcomm.Baud = Convert.ToUInt32(PortBaud); rfpcomm.PortNo = Convert.ToInt32(PortName.Substring(3)); } IsContinue = true; IsFinished = false; try { if (!rfpcomm.Active) { rfpcomm.Active = true; } while (!IsContinue) { rfpcomm.Active = false; } } catch (Exception ex) { _Log.Error(ex.ToString()); } }
FyComm Comm; //丰仪压力机的联网接口组件 /// <summary> /// 开始采集 /// </summary> /// <param name="ControllerOrder"></param> public void StartAcquisition() { Comm = new FyComm(); Comm.SwitchDevice(1); Comm.OnAddItem += new IFyCommEvents_OnAddItemEventHandler(Comm_OnAddItem); Comm.Baud = Convert.ToUInt32(PortBaud); Comm.PortNo = Comm.GetPortNo(PortName); IsContinue = true; IsFinished = false; try { Comm.Active = true; while (!IsContinue) { Comm.Active = false; } } catch (Exception ex) { _Log.Error(ex.ToString()); } }
public override void StartAcquisition() { try { if (parse != null) { FYParse _FYParse = parse as FYParse; _FYParse.OnAddItem += new FYParse.OnAddItemd(Comm_OnAddItem); _FYParse._SerialPort.BaudRate = Convert.ToInt32(Module.SpecialSetting.PortBaud); _FYParse._SerialPort.PortName = Module.SpecialSetting.PortName; while (!IsFinished) { if (_FYParse.Active != true) { if (Module.SpecialSetting.IsDebug) { log.WriteLog("_Comm.Active changed = true", true, false); } _FYParse.Active = true; } Thread.Sleep(500); } _FYParse.Active = false; } else { _Comm = new FyComm(); _Comm.OnAddItem += new IFyCommEvents_OnAddItemEventHandler(Comm_OnAddItem); _Comm.Baud = Convert.ToUInt32(Module.SpecialSetting.PortBaud); _Comm.PortNo = Convert.ToInt32(Module.SpecialSetting.PortName.Substring(3)); while (!IsFinished) { if (_Comm.Active != true) { if (Module.SpecialSetting.IsDebug) { log.WriteLog("_Comm.Active changed = true", true, false); } _Comm.Active = true; } Thread.Sleep(500); } _Comm.Active = false; } } catch (Exception ex) { log.WriteLog(ex.Message + "\r\n" + ex.StackTrace, true, true); } }
FyComm Comm; //丰仪压力机的联网接口组件 /// <summary> /// 开始采集 /// </summary> /// <param name="ControllerOrder"></param> public override void StartAcquisition() { try { if (IsUnitTest) { RunUnitTest(); } else { Comm = new FyComm(); Comm.EnabledUDP(true); Comm.SwitchDevice(1); Comm.OnAddItem += new IFyCommEvents_OnAddItemEventHandler(Comm_OnAddItem); Comm.Host = Module.SpecialSetting.RemotIP; Comm.HostPort = Module.SpecialSetting.RemotPort; Comm.LocalPort = Module.SpecialSetting.LocalPort; while (!IsFinished) { if (Comm.Active != true) { if (Module.SpecialSetting.IsDebug) { log.WriteLog("Comm.Active changed = true", true, false); } Comm.Active = true; } Thread.Sleep(500); } Comm.Active = false; } } catch (Exception ex) { log.WriteLog(ex.Message + "\r\n" + ex.StackTrace, true, true); } }
private void FYInit() { _Comm = new FyComm(); _Comm.OnAddItem += new IFyCommEvents_OnAddItemEventHandler(Comm_OnAddItem); _Comm.Baud = Convert.ToUInt32(Module.SpecialSetting.PortBaud); _Comm.PortNo = Convert.ToInt32(Module.SpecialSetting.PortName.Substring(3)); while (!IsFinished) { if (_Comm.Active != true) { if (Module.SpecialSetting.IsDebug) { log.WriteLog("_Comm.Active changed = true", true, false); } _Comm.Active = true; if (Module.SpecialSetting.IsDebug) { log.WriteLog("MaxForce=0.00f", true, false); log.WriteLog("FinishForce=0.00f", true, false); log.WriteLog("QFState=1", true, false); } MaxForce = 0.00f; FinishForce = 0.00f; QFState = 1; IsFinish = true; } try { if (QFState == 2) { if (Module.SpecialSetting.IsDebug) { log.WriteLog("QFState==2", false, false); log.WriteLog("_Comm.BeginTest", false, false); } _Comm.BeginTest(); QFState = 3; if (Module.SpecialSetting.IsDebug) { log.WriteLog("QFState = 3", false, false); } } else if (QFState == 4) { if (Module.SpecialSetting.IsDebug) { log.WriteLog("QFState ==4", false, false); log.WriteLog("_Comm.EndTest", false, false); } _Comm.EndTest(); QFLLz = _Comm.FeL; QFHLz = _Comm.FeH; QFState = 5; if (Module.SpecialSetting.IsDebug) { log.WriteLog("QFLLz = " + QFLLz.ToString() + ";QFHLz=" + QFHLz.ToString(), false, false); log.WriteLog("QFState = 5", false, false); } } } catch (Exception exQF) { QFState = 6; if (Module.SpecialSetting.IsDebug) { log.WriteLog("QFState = 6", false, false); } log.WriteLog(exQF.Message + "\r\n" + exQF.StackTrace, true, true); } Thread.Sleep(500); } _Comm.Active = false; }
public override void StartAcquisition() { try { if (IsUnitTest) { RunUnitTest(); } else { _Comm = new FyComm(); _Comm.EnabledUDP(true); _Comm.OnAddItem += new IFyCommEvents_OnAddItemEventHandler(Comm_OnAddItem); _Comm.Host = Module.SpecialSetting.RemotIP; _Comm.HostPort = Module.SpecialSetting.RemotPort; _Comm.LocalPort = Module.SpecialSetting.LocalPort; while (!IsFinished) { if (_Comm.Active != true) { if (Module.SpecialSetting.IsDebug) { log.WriteLog("_Comm.Active changed = true", true, false); } _Comm.Active = true; } try { if (QFState == 2) { if (Module.SpecialSetting.IsDebug) { log.WriteLog("QFState==2", false, false); log.WriteLog("_Comm.BeginTest", false, false); } //_Comm.SetZero(TSensorStyle.ssForce); //_Comm.SetZero(TSensorStyle.ssGauge); //_Comm.SetZero(TSensorStyle.ssExtend); //_Comm.SetZero(TSensorStyle.ssDisp); _Comm.BeginTest(); QFState = 3; if (Module.SpecialSetting.IsDebug) { log.WriteLog("QFState = 3", false, false); } } else if (QFState == 4) { if (Module.SpecialSetting.IsDebug) { log.WriteLog("QFState ==4", false, false); log.WriteLog("_Comm.EndTest", false, false); } _Comm.EndTest(); QFLLz = _Comm.FeL; QFHLz = _Comm.FeH; QFState = 5; if (Module.SpecialSetting.IsDebug) { log.WriteLog("QFState = 5", false, false); } } } catch (Exception exQF) { QFState = 6; if (Module.SpecialSetting.IsDebug) { log.WriteLog("QFState = 6", false, false); } log.WriteLog(exQF.Message + "\r\n" + exQF.StackTrace, true, true); } Thread.Sleep(500); } _Comm.Active = false; } } catch (Exception ex) { log.WriteLog(ex.Message + "\r\n" + ex.StackTrace, true, true); } }