/// <summary> /// 获取当工站的夹具号 nCurrentNo当前工站号(站号从1开始)nCurrentNo=工位号,获取的结果是夹具号 /// </summary> /// <param name="nCurrentNo"></param> /// <returns></returns> public int GetSocketNum(int nCurrentNo, double Fine = 0.1) { if (MotionMgr.GetInstace().GetHomeFinishFlag(AxisNo) != AxisHomeFinishFlag.Homed) { return(-1); } lock (locksocketandpos) { double val = MotionMgr.GetInstace().GetAxisPos(AxisNo); foreach (var temp in dicTableSocketAndPos) { if (val < temp.Key + Fine && val > temp.Key - Fine) { int No = (temp.Value + nCurrentNo - 1) % NumStaionsBroundTable; if (No == 0) { return(NumStaionsBroundTable); } else { return(No); } } } return(-1); } }
public static void CloseHardWork() { CameraMgr.GetInstance().Close(); TcpMgr.GetInstance().CloseAllEth(); MotionMgr.GetInstace().Close(); IOMgr.GetInstace().Close(); }
private void Btn_TestStop_Click(object sender, EventArgs e) { DoWhile.StopCirculate(); int nAxisNo = textBox_AxisNo.Text.ToInt(); MotionMgr.GetInstace().StopAxis(nAxisNo); }
private void updatadataGridView() { dataGridView_AxisParamSet.Rows.Clear(); UpdataMotonType(); dataGridView_HomeSet.Rows.Clear(); List <MotionCardBase> list = MotionMgr.GetInstace().GetCardList(); TMovePrm movePrm = new TMovePrm(); THomePrm homePrm = new THomePrm(); foreach (var temp in list) { for (int index = temp.GetMinAxisNo(); index <= temp.GetMaxAxisNo(); index++) { movePrm = MotionMgr.GetInstace().GetAxisMovePrm(index); dataGridView_AxisParamSet.Rows.Add(index.ToString(), MotionMgr.GetInstace().GetAxisName(index), MotionMgr.GetInstace().GetMotorType(index).ToString(), movePrm.VelH.ToString(), movePrm.AccH.ToString(), movePrm.DccH.ToString(), movePrm.VelM.ToString(), movePrm.AccM.ToString(), movePrm.DccM.ToString(), movePrm.VelL.ToString(), movePrm.AccL.ToString(), movePrm.DccL.ToString(), movePrm.PlusePerRote.ToString(), movePrm.AxisLeadRange.ToString()); homePrm = MotionMgr.GetInstace().GetAxisHomePrm(index); dataGridView_HomeSet.Rows.Add( index.ToString(), MotionMgr.GetInstace().GetAxisName(index), homePrm._nHomeMode.ToString(), homePrm._bHomeDir.ToString(), homePrm.VelH.ToString(), homePrm.AccH.ToString(), homePrm.DccH.ToString(), homePrm.VelL.ToString(), homePrm.AccL.ToString(), homePrm.DccL.ToString(), homePrm._iSeachOffstPluse.ToString()); } } }
public void CheckBuzzerPlaneAndUp(bool bManual = false) { if (IOMgr.GetInstace().ReadIoInBit("右装料平台有无感应器")) { Task task0 = new Task(() => { ParamSetMgr.GetInstance().SetBoolParam("右装料平台上升到位", false); Info("装料步进运动"); int pos = MotionMgr.GetInstace().GetAxisPos(AxisZ); pos = pos + (int)(ParamSetMgr.GetInstance().GetDoubleParam("装料步长") * nResolutionZ); MoveSigleAxisPosWaitInpos(AxisZ, pos, MotionMgr.GetInstace().GetAxisMovePrm(AxisZ).VelH, 20, bManual, bManual ? null : this); ParamSetMgr.GetInstance().SetBoolParam("右装料平台上升到位", true); }); task0.Start(); } else { Task task = new Task(() => { Info("回到原始位置"); double pos = GetStationPointDic()["装料原始位"].pointZ; MoveSigleAxisPosWaitInpos(AxisZ, pos, MotionMgr.GetInstace().GetAxisMovePrm(AxisZ).VelH, 20, bManual, this); //AlarmMgr.GetIntance().WarnWithDlg("右剥料工站 装料平台无料,请添加蜂鸣片", bManual ? null : this, CommonDlg.DlgWaranType.WaranOK); AlarmMgr.GetIntance().WarnWithDlg("右剥料工站 装料平台无料,请添加蜂鸣片,添加完成点击OK", this, CommonDlg.DlgWaranType.WaranOK); FindBuzzer(bManual); ParamSetMgr.GetInstance().SetBoolParam("右装料平台上升到位", true); }); task.Start(); task.Wait(); } }
public void MotionStop() { if (nAxisOnLine != -1) { MotionMgr.GetInstace().StopAxis(nAxisOnLine); return; } if (IOMotionDir == null || IOMotionDir == "") { if (BackMotorIo != null && BackMotorIo != "") { IOMgr.GetInstace().WriteIoBit(BackMotorIo, false); } if (ForwardMotorIo != null && ForwardMotorIo != "") { IOMgr.GetInstace().WriteIoBit(ForwardMotorIo, false); } } else { if (ForwardMotorIo != null && ForwardMotorIo != "") { IOMgr.GetInstace().WriteIoBit(ForwardMotorIo, false); } if (IOMotionDir != null && IOMotionDir != "") { IOMgr.GetInstace().WriteIoBit(IOMotionDir, false); } } }
public void MotionBackRun(bool bRunDir = false) { if (nAxisOnLine != -1) { MotionMgr.GetInstace().JogMove(nAxisOnLine, !bOutMotorRunDirOnLine, 0, (double)SpeedType.High); return; } if (IOMotionDir == null || IOMotionDir == "") { if (BackMotorIo != null && BackMotorIo != "") { IOMgr.GetInstace().WriteIoBit(BackMotorIo, true); } if (ForwardMotorIo != null && ForwardMotorIo != "") { IOMgr.GetInstace().WriteIoBit(ForwardMotorIo, false); } } else { if (ForwardMotorIo != null && ForwardMotorIo != "") { IOMgr.GetInstace().WriteIoBit(ForwardMotorIo, true); } if (IOMotionDir != null && IOMotionDir != "") { IOMgr.GetInstace().WriteIoBit(IOMotionDir, bRunDir); } } }
private void EvenAddHardware() { GlobalVariable.g_eventStationStateChanged += StationStateChangedHandler; alarmtimer.Elapsed += new System.Timers.ElapsedEventHandler((object senders, ElapsedEventArgs es) => { // if(!bStartAlarmTimer) { try { if (IOMgr.GetInstace().GetOutputDic().ContainsKey("蜂鸣")) { IOMgr.GetInstace().WriteIoBit("蜂鸣", !IOMgr.GetInstace().ReadIoOutBit("蜂鸣")); } bStartAlarmTimer = true; } catch (Exception ex) { return; } } }); IOMgr.GetInstace().m_deltgateSystemSingl += ProcessSysIo; MotionMgr.GetInstace().m_eventAxisSingl += ProcessSysIo; // 注册安全函数 UserConfig.AddIoSafeOperate(); UserConfig.AddAxisSafeOperate(); }
private void BtnSetXY_Click(object sender, EventArgs e) { if (!bIsAllPointMachine) { if (vc == null || vc.Img == null || !vc.Img.IsInitialized()) { return; } } if (bIsAllPointMachine) { dMx = MotionMgr.GetInstace().GetAxisPos(nAxisX); dMy = MotionMgr.GetInstace().GetAxisPos(nAxisY); } else { HTuple rowc, colc; if (!bModify) { vc.DrawPoint(out rowc, out colc); } else { vc.DrawPointMod(dVy, dVx, out rowc, out colc); } dVx = colc.D; dVy = rowc.D; } }
public void Parse(string DispTraceName) { if (!dispTraces.ContainsKey(DispTraceName)) { return; } List <DispTraceBaseElement> dispTraceBaseElements = dispTraces[DispTraceName]; foreach (var tem in dispTraceBaseElements) { if (tem.GetType() == typeof(DispTraceBaseElementDelay)) { MotionMgr.GetInstace().AddBufDelay(GpName, ((DispTraceBaseElementDelay)tem).delay); } if (tem.GetType() == typeof(DispTraceBaseElementIo)) { MotionMgr.GetInstace().AddBufIo(GpName, ((DispTraceBaseElementIo)tem).DispIoName, ((DispTraceBaseElementIo)tem).bDispIoState); } if (tem.GetType() == typeof(DispTraceBaseElementLine)) { double vellow = ((DispTraceBaseElementLine)tem).TraceMoveParam.SpeedLow; double velhigh = ((DispTraceBaseElementLine)tem).TraceMoveParam.SpeedHigh; double[] StartPoint = new double[3]; StartPoint[0] = ((DispTraceBaseElementLine)tem).cStartPoint.dMx; StartPoint[1] = ((DispTraceBaseElementLine)tem).cStartPoint.dMy; StartPoint[2] = ((DispTraceBaseElementLine)tem).cStartPoint.dMz; MotionMgr.GetInstace().AddBufMove(GpName, BufMotionType.buf_Line3dAbs, 0, 3, velhigh, vellow, null, StartPoint); double[] EndPoint = new double[3]; EndPoint[0] = ((DispTraceBaseElementLine)tem).cEndPoint.dMx; EndPoint[1] = ((DispTraceBaseElementLine)tem).cEndPoint.dMy; EndPoint[2] = ((DispTraceBaseElementLine)tem).cEndPoint.dMz; MotionMgr.GetInstace().AddBufMove(GpName, BufMotionType.buf_Line3dAbs, 0, 3, velhigh, vellow, null, EndPoint); } if (tem.GetType() == typeof(DispTraceBaseElementArc)) { double vellow = ((DispTraceBaseElementArc)tem).TraceMoveParam.SpeedLow; double velhigh = ((DispTraceBaseElementArc)tem).TraceMoveParam.SpeedHigh; double[] StartPoint = new double[3]; StartPoint[0] = ((DispTraceBaseElementArc)tem).cStartPoint.dMx; StartPoint[1] = ((DispTraceBaseElementArc)tem).cStartPoint.dMy; StartPoint[2] = ((DispTraceBaseElementArc)tem).cStartPoint.dMz; MotionMgr.GetInstace().AddBufMove(GpName, BufMotionType.buf_Line3dAbs, 0, 3, velhigh, vellow, null, StartPoint); double[] CenterPoint = new double[3]; CenterPoint[0] = ((DispTraceBaseElementArc)tem).cEndPoint.dMx; CenterPoint[1] = ((DispTraceBaseElementArc)tem).cEndPoint.dMy; double[] EndPoint = new double[3]; EndPoint[0] = ((DispTraceBaseElementArc)tem).cEndPoint.dMx; EndPoint[1] = ((DispTraceBaseElementArc)tem).cEndPoint.dMy; if (((DispTraceBaseElementArc)tem).bIsArcDir)//逆时针 { MotionMgr.GetInstace().AddBufMove(GpName, BufMotionType.buf_Arc2dAbsCCW, 0, 2, velhigh, vellow, CenterPoint, EndPoint); } else { MotionMgr.GetInstace().AddBufMove(GpName, BufMotionType.buf_Arc2dAbsCW, 0, 2, velhigh, vellow, CenterPoint, EndPoint); } } } }
public override void OperateLineBeforeLevave(bool bmanual) { JackUpCliyderUp(false); if (MotionMgr.GetInstace().IsAxisNormalStop(nAxisNo) == AxisState.NormalStop) { MotionMgr.GetInstace().AbsMove(nAxisNo, dDischargePos, (double)SpeedType.High); } }
protected override bool InitStation() { MotionMgr.GetInstace().ServoOn(11); ResetAllLineState(); //Config(); PushMultStep((int)StationStep.StepInit, (int)StationStep.LineRun); return(true); }
public bool IsCanLeave(bool bmanual) { if (MotionMgr.GetInstace().IsAxisNormalStop(nAxisNo) > AxisState.NormalStop) { AlarmMgr.GetIntance().WarnWithDlg($"流水线{lb.LineName} 在出料前,轴{MotionMgr.GetInstace().GetAxisName(nAxisNo)} ,报警{MotionMgr.GetInstace().IsAxisNormalStop(nAxisNo).ToString()},程序停止", null, CommonDlg.DlgWaranType.WaranOK, null, bmanual); StationMgr.GetInstance().Stop(); } bool bIsAxisStop = MotionMgr.GetInstace().IsAxisNormalStop(nAxisNo) == AxisState.NormalStop; return(lb.CheckJackUpCliyderStateInPos(false) && bIsAxisStop); }
private APP() { MotionMgr = MotionMgr.GetInstace(); IOMgr = IOMgr.GetInstace(); AlarmMgr = AlarmMgr.GetIntance(); ConfigToolMgr = ConfigToolMgr.GetInstance(); StationMgr = StationMgr.GetInstance(); ParamSetMgr = ParamSetMgr.GetInstance(); ComMgr = ComMgr.GetInstance(); TcpMgr = TcpMgr.GetInstance(); SocketSeverMgr = SocketSeverMgr.GetInstace(); }
public override bool IsCanLeave(bool bmanual) { if (MotionMgr.GetInstace().IsAxisNormalStop(nAxisNo) > AxisState.NormalStop) { AlarmMgr.GetIntance().WarnWithDlg($"流水线{LineName} 在出料前,轴{MotionMgr.GetInstace().GetAxisName(nAxisNo)} ,报警{MotionMgr.GetInstace().IsAxisNormalStop(nAxisNo).ToString()},程序停止", null, CommonDlg.DlgWaranType.WaranOK, null, bmanual); StationMgr.GetInstance().Stop(); } bool bIsAxisStop = MotionMgr.GetInstace().IsAxisNormalStop(nAxisNo) == AxisState.NormalStop; bool bIsAxisInPosOnOutPos = Math.Abs(MotionMgr.GetInstace().GetAxisActPos(nAxisNo) - dDischargePos) < 0.3; return(CheckJackUpCliyderStateInPos(false) && bIsAxisStop && bIsAxisInPosOnOutPos); }
public bool Init(bool bmanual) { MotionMgr.GetInstace().ServoOn(11); bFirist = true; ResetAllLineState(); Config(); lineSenor.feedMode = FeedMode.前进料; lineLock.bOutMotorRunDir = true; WaranResult waranResult = HomeSigleAxisPosWaitInpos(lineUpDown.nAxisNo, this, 2000000, bmanual); return(waranResult == WaranResult.Run); }
public override bool IsOutFinishDealOK(bool bmaual) { if (MotionMgr.GetInstace().IsAxisNormalStop(nAxisNo) > AxisState.NormalStop) { AlarmMgr.GetIntance().WarnWithDlg($"流水线{LineName} 在出料前,轴{MotionMgr.GetInstace().GetAxisName(nAxisNo)} ,报警{MotionMgr.GetInstace().IsAxisNormalStop(nAxisNo).ToString()},程序停止", null, CommonDlg.DlgWaranType.WaranOK, null, bmaual); StationMgr.GetInstance().Stop(); } bool bIsAxisStop = MotionMgr.GetInstace().IsAxisNormalStop(nAxisNo) == AxisState.NormalStop; double pos = MotionMgr.GetInstace().GetAxisActPos(nAxisNo); bool bIsAxisInPosOnFeedPos = Math.Abs(MotionMgr.GetInstace().GetAxisActPos(nAxisNo) - dFeedPos) < 0.3; return(bIsAxisStop & bIsAxisInPosOnFeedPos); }
private void SaveMotorParam_Click(object sender, EventArgs e) { if (!Directory.Exists(ParamSetMgr.GetInstance().CurrentWorkDir + ("\\") + ParamSetMgr.GetInstance().CurrentProductFile) || ParamSetMgr.GetInstance().CurrentProductFile == null || ParamSetMgr.GetInstance().CurrentProductFile == "") { MessageBox.Show("当前产品文件夹不存在,请创建载入或者创建当前产品", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } TMovePrm prm = new TMovePrm(); THomePrm homePrm = new THomePrm(); int indexCell = 0; for (int index = 0; index < dataGridView_AxisParamSet.RowCount; index++) { int nAxisNo = Convert.ToInt32(dataGridView_AxisParamSet.Rows[index].Cells[0].Value); prm.VelH = Convert.ToDouble(dataGridView_AxisParamSet.Rows[index].Cells[3].Value); prm.AccH = Convert.ToDouble(dataGridView_AxisParamSet.Rows[index].Cells[4].Value); prm.DccH = Convert.ToDouble(dataGridView_AxisParamSet.Rows[index].Cells[5].Value); prm.VelM = Convert.ToDouble(dataGridView_AxisParamSet.Rows[index].Cells[6].Value); prm.AccM = Convert.ToDouble(dataGridView_AxisParamSet.Rows[index].Cells[7].Value); prm.DccM = Convert.ToDouble(dataGridView_AxisParamSet.Rows[index].Cells[8].Value); prm.VelL = Convert.ToDouble(dataGridView_AxisParamSet.Rows[index].Cells[9].Value); prm.AccL = Convert.ToDouble(dataGridView_AxisParamSet.Rows[index].Cells[10].Value); prm.DccL = Convert.ToDouble(dataGridView_AxisParamSet.Rows[index].Cells[11].Value); prm.PlusePerRote = Convert.ToDouble(dataGridView_AxisParamSet.Rows[index].Cells[12].Value); prm.AxisLeadRange = Convert.ToDouble(dataGridView_AxisParamSet.Rows[index].Cells[13].Value); MotionMgr.GetInstace().SetAxisMoveParam(nAxisNo, prm); MotionMgr.GetInstace().SetAxisName(nAxisNo, dataGridView_AxisParamSet.Rows[index].Cells[1].Value == null ? "NoNamedAxis" : dataGridView_AxisParamSet.Rows[index].Cells[1].Value.ToString()); string strAxisType = dataGridView_AxisParamSet.Rows[index].Cells[2].Value == null?MotorType.SEVER.ToString() : dataGridView_AxisParamSet.Rows[index].Cells[2].Value.ToString(); MotionMgr.GetInstace().SetMotorType(nAxisNo, (MotorType)Enum.Parse(typeof(MotorType), strAxisType)); indexCell = 2; homePrm._nHomeMode = Convert.ToInt32(dataGridView_HomeSet.Rows[index].Cells[indexCell++].Value); homePrm._bHomeDir = Convert.ToBoolean(dataGridView_HomeSet.Rows[index].Cells[indexCell++].Value); homePrm.VelH = Convert.ToDouble(dataGridView_HomeSet.Rows[index].Cells[indexCell++].Value); homePrm.AccH = Convert.ToDouble(dataGridView_HomeSet.Rows[index].Cells[indexCell++].Value); homePrm.DccH = Convert.ToDouble(dataGridView_HomeSet.Rows[index].Cells[indexCell++].Value); homePrm.VelL = Convert.ToDouble(dataGridView_HomeSet.Rows[index].Cells[indexCell++].Value); homePrm.AccL = Convert.ToDouble(dataGridView_HomeSet.Rows[index].Cells[indexCell++].Value); homePrm.DccL = Convert.ToDouble(dataGridView_HomeSet.Rows[index].Cells[indexCell++].Value); homePrm._iSeachOffstPluse = Convert.ToDouble(dataGridView_HomeSet.Rows[index].Cells[indexCell++].Value); MotionMgr.GetInstace().SetAxisHomeParam(nAxisNo, homePrm); } ConfigToolMgr.GetInstance().SaveMoveParam(); ConfigToolMgr.GetInstance().SaveHomeParam(); }
public bool GoTableHome(bool bmanual = false) { ParamSetMgr.GetInstance().SetBoolParam("转盘回零完成", false); if (!checkSafe()) { return(false); } Info("转盘开始回零"); if (bmanual || MotionMgr.GetInstace().GetHomeFinishFlag(AxisU) != AxisHomeFinishFlag.Homed) { MotionMgr.GetInstace().ServoOn((short)AxisU); HomeSigleAxisPosWaitInpos(AxisU, this, 120000, bmanual); } ParamSetMgr.GetInstance().SetBoolParam("转盘回零完成", true); Info("转盘回零完成"); return(true); }
public static bool IsSafeWhenLeftRightUVOut(string ioName, bool bVal) { if (ioName == "侧向UV气缸" && bVal) { int nAxisNo = 8; AxisState axisState = MotionMgr.GetInstace().IsAxisNormalStop(nAxisNo); if (axisState < AxisState.NormalStop) { if (GlobalVariable.g_StationState != StationState.StationStateRun) { MessageBox.Show("侧向UV气缸推出时,转盘在转动,不能推出", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error); } _logger.Error("侧向UV气缸推出时,转盘在转动,不能推出"); return(false); } } return(true); }
public static void CloseHardWork() { //for (int i = 0; i < 6; i++) // LightControl.GetInstance().CloseLight(i); ResetIO(); AlarmMgr.GetIntance().StopAlarmBeet(); CameraMgr.GetInstance().Close(); TcpMgr.GetInstance().CloseAllEth(); MotionMgr.GetInstace().Close(); IOMgr.GetInstace().Close(); if (ParamSetMgr.GetInstance().GetBoolParam("是否选择程控电源")) { OtherDevices.ckPower.SetVoltage(1, 0); OtherDevices.ckPower.SetVoltage(2, 0); } // LightControl.GetInstance().Close(); // Weighing.GetInstance().Close(); }
private bool checkSafe() { StationAA stationAA = (StationAA)StationMgr.GetInstance().GetStation("AA站"); StationDisp stationDisp = (StationDisp)StationMgr.GetInstance().GetStation("点胶站"); double SafeHeightAA = stationAA.GetStationPointDic()["安全位置"].pointZ; double SafeHeightDisp = stationDisp.GetStationPointDic()["安全位置"].pointZ; double getAAPos = MotionMgr.GetInstace().GetAxisPos(stationAA.AxisZ); double getDispPos = MotionMgr.GetInstace().GetAxisPos(stationDisp.AxisZ); if (MotionMgr.GetInstace().GetHomeFinishFlag(stationAA.AxisZ) != AxisHomeFinishFlag.Homed || getAAPos < SafeHeightAA - 0.5) { if (GlobalVariable.g_StationState != StationState.StationStateRun) { MessageBox.Show("转盘运动前,检查AA站Z轴没有回原点或者低于安全高度", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly); } return(false); } if (MotionMgr.GetInstace().GetHomeFinishFlag(stationDisp.AxisZ) != AxisHomeFinishFlag.Homed || getDispPos < SafeHeightDisp - 0.5) { if (GlobalVariable.g_StationState != StationState.StationStateRun) { MessageBox.Show("转盘运动前,检查点胶站Z轴没有回原点或者低于吐胶点高度", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly); } return(false); } //if (!IOMgr.GetInstace().ReadIoInBit("A治具盖上检测")) if (!SysFunConfig.LodUnloadPatten.IsSafeWhenURun("A")) { MessageBox.Show("转盘运动前,检查A治具盖上检测失败!", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly); return(false); } // if (!IOMgr.GetInstace().ReadIoInBit("B治具盖上检测")) if (!SysFunConfig.LodUnloadPatten.IsSafeWhenURun("B")) { MessageBox.Show("转盘运动前,检查B治具盖上检测失败!", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly); return(false); } Info($"安全位置检查成功,disp:{MotionMgr.GetInstace().GetAxisPos(stationDisp.AxisZ)}aa:{ MotionMgr.GetInstace().GetAxisPos(stationAA.AxisZ)}."); return(true); }
public string GetStationName(double Fine = 0.1) { if (MotionMgr.GetInstace().GetHomeFinishFlag(AxisNo) != AxisHomeFinishFlag.Homed) { return("None"); } lock (lockstationandpos) { double val = MotionMgr.GetInstace().GetAxisPos(AxisNo); foreach (var temp in dicTableStationAndPos) { if (val < temp.Key + Fine && val > temp.Key - Fine) { return(temp.Value); } } } return("None"); }
public static bool IsSafeWhenTableAxisMoveHandler(int nAxisNo, double currentpos, double dsstpos, MoveType moveType) { StationAA stationAA = (StationAA)StationMgr.GetInstance().GetStation("AA站"); StationDisp stationDisp = (StationDisp)StationMgr.GetInstance().GetStation("点胶站"); double SafeHeightAA = stationAA.GetStationPointDic()["安全位置"].pointZ; double SafeHeightDisp = stationDisp.GetStationPointDic()["安全位置"].pointZ; // double SafeHeightDisp = stationDisp.GetStationPointDic()["安全位置"].pointZ; if (MotionMgr.GetInstace().GetAxisName(nAxisNo) == "U") { if (MotionMgr.GetInstace().GetHomeFinishFlag(stationAA.AxisZ) != AxisHomeFinishFlag.Homed || MotionMgr.GetInstace().GetAxisPos(stationAA.AxisZ) < SafeHeightAA - 0.5) { if (GlobalVariable.g_StationState != StationState.StationStateRun) { MessageBox.Show("转盘运动前,检查AA站Z轴没有回原点或者低于安全高度", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error); } return(false); } if (MotionMgr.GetInstace().GetHomeFinishFlag(stationDisp.AxisZ) != AxisHomeFinishFlag.Homed || MotionMgr.GetInstace().GetAxisPos(stationDisp.AxisZ) < SafeHeightDisp - 1) { if (GlobalVariable.g_StationState != StationState.StationStateRun) { MessageBox.Show("转盘运动前,检查点胶站Z轴没有回原点或者低于吐胶点高度", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error); } _logger.Error("转盘运动前,检查点胶站Z轴没有回原点或者低于吐胶点高度"); return(false); } if (ParamSetMgr.GetInstance().GetBoolParam("是否侧向UV") && (!IOMgr.GetInstace().ReadIoInBit("左侧UV原位") || !IOMgr.GetInstace().ReadIoInBit("左侧UV原位"))) { if (GlobalVariable.g_StationState != StationState.StationStateRun) { MessageBox.Show("转盘运动前,左右UV是否在原位", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error); } _logger.Error("转盘运动前,左右UV是否在原位"); return(false); } } return(true); }
public bool MoveY(double pos, SpeedType speedType) { bool result = false; MotionMgr.GetInstace().AbsMove(AxisY, pos, (double)speedType); Stopwatch stopwatch = new Stopwatch(); stopwatch.Restart(); do { if (stopwatch.ElapsedMilliseconds > 30000) { return(false); } if (MotionMgr.GetInstace().IsAxisNormalStop(AxisY) == AxisState.NormalStop) { return(true); } Thread.Sleep(10); }while (true); }
public void Move(int nAxisNo, double distance, int speedtype) { MotionMgr.GetInstace().AbsMove(nAxisNo, distance, speedtype); DoWhile doWhile = new DoWhile((time, dowhile, bmanual2, obj) => { AxisState axisState = MotionMgr.GetInstace().IsAxisNormalStop(nAxisNo); if (axisState == AxisState.NormalStop) { return(WaranResult.Run); } else if (axisState == AxisState.Moving) { return(WaranResult.CheckAgain); } else { logger.Warn(string.Format("{0}轴状态:{1}", nAxisNo, axisState)); throw new Exception("电机测试报警停止" + string.Format("{0}轴状态:{1}", nAxisNo, axisState)); } }, 3000000); doWhile.doSomething(null, doWhile, true, null); }
public bool WaitXY(double posX, double posY) { bool result = false; Stopwatch stopwatch = new Stopwatch(); stopwatch.Restart(); do { if (stopwatch.ElapsedMilliseconds > 10000) { return(false); } if (MotionMgr.GetInstace().IsAxisNormalStop(AxisY) == AxisState.NormalStop && MotionMgr.GetInstace().IsAxisNormalStop(AxisX) == AxisState.NormalStop) { return(true); } //if (Math.Abs(MotionMgr.GetInstace().GetAxisPos(AxisX) - posX) < 0.01 && Math.Abs(MotionMgr.GetInstace().GetAxisPos(AxisY) - posY) < 0.01) //{ // return true; //} Thread.Sleep(10); }while (true); }
public bool GoSanpHome(bool bmanual = false) { IOMgr.GetInstace().WriteIoBit($"相机光源", true); Info("点胶开始回零"); ParamSetMgr.GetInstance().SetBoolParam("点胶回零完成", false); MotionMgr.GetInstace().ServoOn((short)AxisZ); MotionMgr.GetInstace().ServoOn((short)AxisX); MotionMgr.GetInstace().ServoOn((short)AxisY); if (bmanual || MotionMgr.GetInstace().GetHomeFinishFlag(AxisZ) != AxisHomeFinishFlag.Homed) { HomeSigleAxisPosWaitInpos(AxisZ, this, 120000, bmanual); } if (bmanual || MotionMgr.GetInstace().GetHomeFinishFlag(AxisX) != AxisHomeFinishFlag.Homed) { HomeSigleAxisPosWaitInpos(AxisX, this, 120000, bmanual); } if (bmanual || MotionMgr.GetInstace().GetHomeFinishFlag(AxisY) != AxisHomeFinishFlag.Homed) { HomeSigleAxisPosWaitInpos(AxisY, this, 120000, bmanual); } ParamSetMgr.GetInstance().SetBoolParam("点胶回零完成", true); Info("点胶回零完成"); return(true); }
protected override void StationWork(int step) { if (ParamSetMgr.GetInstance().GetIntParam("右剥料屏蔽") == 1) { ParamSetMgr.GetInstance().SetBoolParam("右剥料完成", true); return; } WaranResult waranResult; bool bfind = ParamSetMgr.GetInstance().GetBoolParam("右搜寻蜂鸣器成功"); bool bgooripos = ParamSetMgr.GetInstance().GetBoolParam("右剥料归位"); PlaneState planeState = PlaneMgr.GetInstance().PlaneArr[(int)PlaneType.rightStripPlane].planeState; NozzleState nozzleState = NozzleMgr.GetInstance().nozzleArr[(int)NozzleType.RightStripNozzle].nozzleState; if (ParamSetMgr.GetInstance().GetBoolParam("右搜寻蜂鸣器成功") && ParamSetMgr.GetInstance().GetBoolParam("右剥料归位") && PlaneMgr.GetInstance().PlaneArr[(int)PlaneType.rightStripPlane].planeState == PlaneState.None && NozzleMgr.GetInstance().nozzleArr[(int)NozzleType.RightStripNozzle].nozzleState == NozzleState.Have && GlobalVariable.g_StationState == StationState.StationStateRun) { Info(string.Format("右装料平台有无感应器{0},右搜寻蜂鸣器成功{1},右拨料平台状态{2},右剥料吸嘴状态{3} 右剥料归位{4}", IOMgr.GetInstace().ReadIoInBit("右装料平台有无感应器"), ParamSetMgr.GetInstance().GetBoolParam("右搜寻蜂鸣器成功"), PlaneMgr.GetInstance().PlaneArr[(int)PlaneType.rightStripPlane].planeState, NozzleMgr.GetInstance().nozzleArr[(int)NozzleType.RightStripNozzle].nozzleState, ParamSetMgr.GetInstance().GetBoolParam("右剥料归位"))); ///loadState = LoadState.exceing; Carray(); // loadState = LoadState.None; } switch (step) { case (int)StationStep.step_init: Init(); retry_FindBuzzer: waranResult = FindBuzzer(); if (waranResult == WaranResult.Retry) { goto retry_FindBuzzer; } if (ParamSetMgr.GetInstance().GetBoolParam("右搜寻蜂鸣器成功")) { retry_go_蜂鸣器顶位: if (sys.g_AppMode == AppMode.AirRun) { ParamSetMgr.GetInstance().SetIntParam("右蜂鸣器顶位", (int)GetStationPointDic()["装料原始位"].pointZ); } WaranResult waranResult1 = MoveSigleAxisPosWaitInpos(AxisZ, ParamSetMgr.GetInstance().GetIntParam("右蜂鸣器顶位"), (int)MotionMgr.GetInstace().GetAxisMovePrm(AxisZ).VelH, 20, false, this, 60000); if (waranResult1 == WaranResult.Retry) { goto retry_go_蜂鸣器顶位; } } MoveSigleAxisPosWaitInpos(AxisY, GetStationPointDic()["剥料准备位"].pointY, (double)SpeedType.High, 20, false, this, 60000); PushMultStep((int)StationStep.step_Separate); ParamSetMgr.GetInstance().SetBoolParam("右剥料归位", true); ParamSetMgr.GetInstance().SetIntParam("右剥料次数", 0); DelCurrentStep(); break; case (int)StationStep.step_Separate: ParamSetMgr.GetInstance().SetBoolParam("右剥料完成", false); if (PlaneMgr.GetInstance().PlaneArr[(int)PlaneType.rightStripPlane].planeState == PlaneState.None) { break; } int Count = ParamSetMgr.GetInstance().GetIntParam("右剥料次数"); if (Count > 6) { PushMultStep((int)StationStep.step_Separate); DelCurrentStep(); break; } Separate(Count); Count = ParamSetMgr.GetInstance().GetIntParam("右剥料次数"); if (Count >= 2 && Count <= 6) { ParamSetMgr.GetInstance().SetBoolParam("右剥料完成", true); PushMultStep((int)StationStep.step_WaitGetFinish); DelCurrentStep(); } else if (Count > 6) { ParamSetMgr.GetInstance().SetBoolParam("右剥料完成", false); PushMultStep((int)StationStep.step_Separate); DelCurrentStep(); break; } else { PushMultStep((int)StationStep.step_Separate); DelCurrentStep(); } break; case (int)StationStep.step_WaitGetFinish: if (ParamSetMgr.GetInstance().GetBoolParam("右剥料取料完成")) { ParamSetMgr.GetInstance().SetBoolParam("右剥料取料完成", false); PushMultStep((int)StationStep.step_Separate); DelCurrentStep(); } break; } }
private void LoadWortk(bool bManual = false) { try { if (!ParamSetMgr.GetInstance().GetBoolParam("右剥料回原点成功")) { return; } if (!IOMgr.GetInstace().ReadIoInBit("右装料平台有无感应器") && !ParamSetMgr.GetInstance().GetBoolParam("右搜寻蜂鸣器成功") && loadState != LoadState.exceing && sys.g_AppMode == AppMode.AirRun && GlobalVariable.g_StationState == StationState.StationStateRun) { Info(string.Format("右装料平台有无感应器{0},右搜寻蜂鸣器成功{1},右拨料平台状态{2},右剥料吸嘴状态{3} 右剥料归位{4}", IOMgr.GetInstace().ReadIoInBit("右装料平台有无感应器"), ParamSetMgr.GetInstance().GetBoolParam("右搜寻蜂鸣器成功"), PlaneMgr.GetInstance().PlaneArr[(int)PlaneType.rightStripPlane].planeState, NozzleMgr.GetInstance().nozzleArr[(int)NozzleType.RightStripNozzle].nozzleState, ParamSetMgr.GetInstance().GetBoolParam("右剥料归位"))); retry_find: loadState = LoadState.exceing; WaranResult waranResult = FindBuzzer(); if (waranResult == WaranResult.Retry) { goto retry_find; } loadState = LoadState.None; } if (ParamSetMgr.GetInstance().GetBoolParam("右搜寻蜂鸣器成功") && ParamSetMgr.GetInstance().GetBoolParam("右装料平台上升到位") && NozzleMgr.GetInstance().nozzleArr[(int)NozzleType.RightStripNozzle].nozzleState == NozzleState.None && loadState != LoadState.exceing && GlobalVariable.g_StationState == StationState.StationStateRun) { Info(string.Format("右装料平台有无感应器{0},右搜寻蜂鸣器成功{1},右拨料平台状态{2},右剥料吸嘴状态{3} 右剥料归位{4}", IOMgr.GetInstace().ReadIoInBit("右装料平台有无感应器"), ParamSetMgr.GetInstance().GetBoolParam("右搜寻蜂鸣器成功"), PlaneMgr.GetInstance().PlaneArr[(int)PlaneType.rightStripPlane].planeState, NozzleMgr.GetInstance().nozzleArr[(int)NozzleType.RightStripNozzle].nozzleState, ParamSetMgr.GetInstance().GetBoolParam("右剥料归位"))); loadState = LoadState.exceing; Pick(); loadState = LoadState.None; } if (ParamSetMgr.GetInstance().GetBoolParam("右搜寻蜂鸣器成功") && !ParamSetMgr.GetInstance().GetBoolParam("右装料平台上升到位") && GlobalVariable.g_StationState == StationState.StationStateRun) { Info("装料步进运动"); int pos = MotionMgr.GetInstace().GetAxisPos(AxisZ); double steplen = ParamSetMgr.GetInstance().GetDoubleParam("装料步长"); pos = pos + (int)(steplen * nResolutionZ); MoveSigleAxisPosWaitInpos(AxisZ, pos, MotionMgr.GetInstace().GetAxisMovePrm(AxisZ).VelH, 20, bManual, this); ParamSetMgr.GetInstance().SetBoolParam("右装料平台上升到位", true); } } catch (Exception e) { loadState = LoadState.None; Warn("异常发生" + e.Message); return; } }