/// <summary> /// 紧急停止处理 /// </summary> private void EMG() { XTaskManager.Instance.FindTaskById((int)TasksId.Manchine).TaskEStop(); if (Globals.settingMachineInfo.什么机器 == WhichMachine.MMS) { XTaskManager.Instance.FindTaskById((int)TasksId.MMS测试).TaskEStop(); } else { XTaskManager.Instance.FindTaskById((int)TasksId.测试).TaskEStop(); } //XTaskManager.Instance.FindTaskById((int)TasksId.Manchine).PostTaskAlarm(XAlarmLevel.STOP, (int)AlarmCode.急停, AlarmCategory.SYSTEM.ToString(), "紧急停止"); Globals.PostAlarmMachine(XAlarmLevel.STOP, (int)AlarmCode.急停, AlarmCategory.SYSTEM.ToString(), "紧急停止"); //add sth like aixs Gg.Set_Servo(0, 1, false);//close seveo on PVar.IsSysEmcStop = true; Globals.Flag_ManualStart = false; PVar.AutoRunFlag = false; GoHome.Instance.Reset.Result = false; }
private FunctionStatus InitHoming() { switch (InitHomingStep) { case 10: AutoRunstep = 0; Gg.Set_Servo(0, BVar.MMSY, true); //open servo on Thread.Sleep(200); SetStep("开始回零.......", Mycolor.None); InitHomingStep = 15; break; case 15: Gg.SetDo(0, Gg.OutPutMMS0.产品定位气缸电磁阀, 0); SetStep("定位气缸复位......", Mycolor.None); InitHomingDelay.InitialTime(); InitHomingStep = 20; break; case 20: if (Gg.GetDi(0, Gg.InPutMMS0.气缸缩回位置感应器) == 1) { SetStep("定位气缸在缩回位置", Mycolor.None); InitHomingStep = 30; } else if (InitHomingDelay.TimeIsUp(2000)) { SetStep("定位气缸缩回位置信号异常!", Mycolor.ErrorRed); PostTaskAlarm(XAlarmLevel.STOP, (int)AlarmCode.载具进出气缸缩回信号异常, AlarmCategory.MOTION.ToString(), "载具进出气缸缩回信号异常"); InitHomingStep = 8000; } break; case 30: SetStep("测试y轴开始回原点…", Mycolor.None); GoHome.Instance.AxisHome[0, 1].Result = false; GoHome.Instance.AxisHome[0, 1].Enable = true; GoHome.Instance.AxisHome[0, 1].Step = 10; TimeOut = API.GetTickCount(); InitHomingStep = 40; break; case 40: GoHome.GotoHome(0, 1, 30, -1000, 5, 1, 10); if (GoHome.Instance.AxisHome[0, 1].Step == 0 && GoHome.Instance.AxisHome[0, 1].Enable) { GoHome.Instance.AxisHome[0, 1].Enable = false; if (GoHome.Instance.AxisHome[0, 1].Result) { SetStep("测试y轴回原点成功…", Mycolor.None); InitHomingStep = 50; } else { SetStep("测试y轴回原点失败…", Mycolor.ErrorRed); InitHomingStep = 8000; } } break; case 50: //等待位置 Gg.AbsMotion(0, BVar.MMSY, mFunction.Pos.TeachAxis1[0, 0], PVar.ParAxis.Speed[BVar.MMSY]); TimeOut = API.GetTickCount(); InitHomingStep = 60; break; case 60: if (Gg.ZSPD(0, BVar.MMSY)) { SetStep("测试y轴运动到初始位置成功…", Mycolor.None); InitHomingStep = 2000; } break; case 2000: InitHomingStep = 0; SetStep("MMS测试工站复位OK!", Mycolor.None); SetState(XTaskState.WAITRUN); SetStepNum(InitHomingStep); HomeOK = true; PVar.LampStatus = 20; PostTaskAlarm(XAlarmLevel.RST, (int)AlarmCode.位, AlarmCategory.RESET.ToString(), "RST"); //for errorcode return(FunctionStatus.Finish); case 8000: InitHomingStep = 0; PVar.LampStatus = 10; return(FunctionStatus.Error); } SetStepNum(InitHomingStep); return(FunctionStatus.Working); }