protected override void LogicImpl() { switch (LG.Step) { case 1: for (int i = 0; i < CTRCard.Axis_Z.Count; i++) { CTRCard.Axis_Z[i].MC_MoveAbs(Product.Inst.Stickdata.ZSafePos); } LG.StepNext(2); break; case 2: if (CTRCard.ZArrive) { CTRCard.Axis_X.MC_MoveAbs(targetPos.X); CTRCard.Axis_Y.MC_MoveAbs(targetPos.Y); LG.StepNext(3); } break; case 3: if (CTRCard.XYArrive) { LG.End(); } break; } }
protected override void LogicImpl() { switch (LG.Step) { case 1: DeviceRsDef.Ax_TakeZ.MC_MoveAbs(Pos_SafeZ); //Z到安全高度 DeviceRsDef.Ax_PickZ.MC_MoveAbs(TaskMain.PickJump.Ready.Z); //拾取Z到安全高度 LG.StepNext(2); break; case 2: if (!DeviceRsDef.Ax_TakeZ.busy && !DeviceRsDef.Ax_PickZ.busy) //等待Z到位 { DeviceRsDef.Ax_TrayX.MC_MoveAbs(x); //X到目标位置 DeviceRsDef.Ax_TakeY.MC_MoveAbs(y); //Y到目标位置 LG.StepNext(3); } break; case 3: if (!DeviceRsDef.Ax_TrayX.busy && !DeviceRsDef.Ax_TakeY.busy) //等待XY到位 { DeviceRsDef.Ax_TakeZ.MC_MoveAbs(z); //Z到目标高度 LG.StepNext(4); } break; case 4: if (!DeviceRsDef.Ax_TakeZ.busy) //等待Z到位 { LG.End(); } break; } }
protected override void LogicImpl() { switch (LG.Step) { case 1: TaskMain.PickJump.Start(Pos_Discard); //跳跃到弃料位置 LG.StepNext(2); break; case 2: if (TaskMain.PickJump.GetSta() == 0) //等待定位结束 { DeviceRsDef.Q_PickVacuo.OFF(); //关真空 DeviceRsDef.Q_PickBlow.ON(); //开吹气 Tm.Restart(); //定时器复位 LG.StepNext(3); } break; case 3: if (Tm.ElapsedMilliseconds > 100) //固定弃料吹气100ms { DeviceRsDef.Q_PickBlow.OFF(); //关吹气 LG.End(); } break; } }
protected override void LogicImpl() { switch (LG.Step) { case 1: DeviceRsDef.Q_Rise.OFF(); //顶升气缸下降 if (DeviceRsDef.I_RiseDown.Value) //到低位感应到执行接下来的动作 { if (!DeviceRsDef.I_BeltUnfeedOut.Value) { LG.StepNext(2); } else { Alarm.SetAlarm(AlarmLevelEnum.Level1, "出料位置有载具"); } } break; case 2: DeviceRsDef.Axis_BeltFeed.MC_MoveSpd(10); //中间皮带运行 DeviceRsDef.Axis_BeltUnfeed.MC_MoveSpd(10); //右侧皮带运行 LG.StepNext(3); break; case 3: if (fun.F_Trig(DeviceRsDef.I_BeltFeedOut.Value)) //载具完全脱离中间皮带 { DeviceRsDef.Axis_BeltFeed.MC_StopDec(); //中间皮带停止 LG.StepNext(4); } break; case 4: if (DeviceRsDef.I_BeltUnfeedOut.Value) //载具到位 { DeviceRsDef.Axis_BeltUnfeed.MC_StopDec(); //右侧皮带停止 LG.StepNext(5); } break; case 5: if (DeviceRsDef.Axis_BeltUnfeed.status == 0) { LG.StepNext(0xef); } break; case 0xef: LG.End(); break; } }
protected override void LogicImpl() { switch (LG.Step) { case 1: if (Product.Inst.IsAging) { LG.StepNext(0xef); } else { LG.StepNext(2); } break; case 2: if (DeviceRsDef.I_FeederReady.Value) { DeviceRsDef.Q_FeederRequest.OFF(); LG.StepNext(0xef); } else { LG.StepNext(3); } break; case 3: if (!DeviceRsDef.I_FeederReady.Value) { DeviceRsDef.Q_FeederRequest.ON(); LG.StepNext(4); } break; case 4: if (DeviceRsDef.I_FeederReady.Value) { DeviceRsDef.Q_FeederRequest.OFF(); LG.StepNext(0xef); } break; case 0xef: LG.End(); break; } }
protected override void LogicImpl() { switch (LG.Step) { case 1: DeviceRsDef.Ax_PickZ.MC_MoveAbs(Ready.Z); //Z到安全高度 LG.StepNext(2); break; case 2: if (!DeviceRsDef.Ax_PickZ.busy || System.Math.Abs(Ready.Z - DeviceRsDef.Ax_PickZ.currPos) <= PreInpZ) //Z定位结束或到达提前点 { DeviceRsDef.Ax_PickX.MC_MoveAbs(PosTar.X); //定位到目标X DeviceRsDef.Ax_PickY.MC_MoveAbs(PosTar.Y); //定位到目标Y DeviceRsDef.Ax_PickR.MC_MoveAbs(PosTar.R); //定位到目标R LG.StepNext(3); } break; case 3: if (!DeviceRsDef.Ax_PickX.busy && (!DeviceRsDef.Ax_PickY.busy || System.Math.Abs(PosTar.Y - DeviceRsDef.Ax_PickY.currPos) < PreInpY) && //Y轴结束或到达提前点 !DeviceRsDef.Ax_PickR.busy) //XYZ定位结束 { VacuoResult = (!CheckVacuo || DeviceRsDef.I_PickVacuo.value); if (VacuoResult) { DeviceRsDef.Ax_PickZ.MC_MoveAbs(PosTar.Z); //Z到目标位置 LG.StepNext(4); } else { LG.End(); } } break; case 4: if (!DeviceRsDef.Ax_PickZ.busy) //Z定位结束 { LG.End(); } break; } }
protected override void LogicImpl() { switch (LG.Step) { case 1: FPointXYZR p = TaskMain.PickTake.Pos_Take.Clone(); //取晶位置,clone出来 p.Z = TaskMain.PickJump.Ready.Z; //Z位置改成预备高度 TaskMain.PickJump.Start(p); //跳跃到取晶位上方 LG.StepNext(2); break; case 2: if (TaskMain.PickJump.GetSta() == 0) //等待定位结束 { DeviceRsDef.Ax_PickZ.MC_MoveAbs(0, Pos_DetectMax); //以最慢速度向测高极限移动 LG.StepNext(3); } break; case 3: if (DeviceRsDef.Ax_PickZ.busy) //在轴运行过程中 { if (DeviceRsDef.I_PickDetect.value) //检测到测高信号 { TaskMain.PickTake.Pos_Take.Z = DeviceRsDef.Ax_PickZ.currPos; //更新取晶高度 DeviceRsDef.Ax_PickZ.MC_Stop(); //停止轴 LG.StepNext(4); // } } else //测高轴运行结束 { MessageBox.Show("测高失败,到达测高极限", "提示"); LG.End(); } break; case 4: if (!DeviceRsDef.Ax_PickZ.busy) { MessageBox.Show("测高完成,取晶高度已更新", "提示"); LG.End(); } break; } }
protected override void LogicImpl() { switch (LG.Step) { case 1: if (DeviceRsDef.I_BeltPreFeedOut.Value) //预进料感应到载具直接结束 { LG.StepNext(0xef); } else { LG.StepNext(2); } break; case 2: DeviceRsDef.Q_PreFeedRequest.ON(); //向上一台设备发送送料信号 DeviceRsDef.Axis_BeltPreFeed.MC_MoveSpd(10); //左侧皮带运行 LG.StepNext(3); break; case 3: if (DeviceRsDef.I_BeltPreFeedOut.Value) //载具到预备位置 { DeviceRsDef.Q_PreFeedRequest.OFF(); //停止左侧皮带 DeviceRsDef.Axis_BeltPreFeed.MC_Stop(); //停止向前端发送要料信号 LG.StepNext(4); } break; case 4: if (DeviceRsDef.Axis_BeltPreFeed.status == 0) //皮带停稳并结束流程 { LG.StepNext(0xef); } break; case 0xef: LG.End(); break; } }
protected override void LogicImpl() { if (Num_Level < 2) { Num_Level = 2; //数据保护,不允许小于2 } switch (LG.Step) { case 1: if (!DeviceRsDef.Ax_LoadZ.busy) { DeviceRsDef.Ax_LoadZ.MC_MoveAbs(Pos_First + CurIdx * (Pos_Last - Pos_First) / (Num_Level - 1)); LG.StepNext(2); } break; case 2: if (!DeviceRsDef.Ax_LoadZ.busy) { LG.End(); } break; } }
protected override void LogicImpl() { switch (LG.Step) { case 1: if (TaskMain.StackLoad.GetSta() == 0) //等上次的堆叠定位结束 { if (!TaskMain.StackLoad.Finish) //堆叠还没用完 { DeviceRsDef.Q_TakeClamp.OFF(); //上料夹爪张开 DeviceRsDef.Q_TrayAdjustX.OFF(); //矫正X张开 DeviceRsDef.Q_TrayAdjustY.OFF(); //矫正Y张开 Tm.Restart(); //开始计时 LG.StepNext(2); } else //堆叠用完 { DeviceRsDef.Ax_TakeZ.MC_MoveAbs(TaskMain.TrayJump.Pos_SafeZ); //取料Z到安全位 LG.StepNext(0xE0); //到异常结束 } } break; case 2: if (Tm.ElapsedMilliseconds < 1000) //1000ms内检测信号OK { if (DeviceRsDef.I_TakeClampOFF1.value && //1号夹爪张开到位 DeviceRsDef.I_TakeClampOFF2.value && //2号夹爪召开到位 !DeviceRsDef.I_PutInp1.value && //1号载台没有障碍物 !DeviceRsDef.I_PutInp2.value) //2号载台没有障碍物 { TaskMain.TrayJump.Start(Pos_TrayX, Pos_TakeY, Pos_TakeZ); //取料平台到取料位 LG.StepNext(3); } } else //1000ms后信号还是不正常 { if (!DeviceRsDef.I_TakeClampOFF1.value || //1号爪张开未到位 !DeviceRsDef.I_TakeClampOFF2.value) //2号爪张开未到位 { MessageBox.Show("检测到取Tray盘夹爪张开未到位", "警告"); } if (DeviceRsDef.I_PutInp1.value || //1号平台有障碍物 DeviceRsDef.I_PutInp2.value) //2号平台有障碍物 { MessageBox.Show("检测到载台已有Tray盘,请人工取走", "警告"); } //切换到停止状态 LG.StepNext(0xE0); //到异常结束 } break; case 3: if (TaskMain.TrayJump.GetSta() == 0) //等待取料平台跳跃完成 { Tm.Restart(); //开始计时 LG.StepNext(4); } break; case 4: if (Tm.ElapsedMilliseconds < 200) //延时内信号正常 { if (((TaskMain.LogicMain.GroupEn[0] && DeviceRsDef.I_TakeInp1.value) || (!TaskMain.LogicMain.GroupEn[0] && !DeviceRsDef.I_TakeInp1.value)) && //1号堆叠信号正常 ((TaskMain.LogicMain.GroupEn[1] && DeviceRsDef.I_TakeInp2.value) || (!TaskMain.LogicMain.GroupEn[1] && !DeviceRsDef.I_TakeInp2.value))) //2号堆叠信号正常 { DeviceRsDef.Q_TakeClamp.ON(); //夹爪夹紧 Tm.Restart(); //开始计时 LG.StepNext(5); } } else //延时后信号异常 { if ((!TaskMain.LogicMain.GroupEn[0] && DeviceRsDef.I_TakeInp1.value) || //1号没启用,但是有信号 (!TaskMain.LogicMain.GroupEn[1] && DeviceRsDef.I_TakeInp2.value) || //2号没启用,但是有信号 (TaskMain.LogicMain.GroupEn[0] && TaskMain.LogicMain.GroupEn[1] && (DeviceRsDef.I_TakeInp1.value ^ DeviceRsDef.I_TakeInp2.value))) //1、2都启用了,但是只有一边有信号 { DeviceRsDef.Ax_TakeZ.MC_MoveAbs(TaskMain.TrayJump.Pos_SafeZ); //取料Z到安全位 MessageBox.Show("检测到Tray盘上料堆叠异常,请确保上料堆叠正常"); LG.StepNext(0xE0); //跳到异常结束 } else { TaskMain.StackLoad.GoNext(); //堆叠到下一层 LG.StepNext(1); //重新开始流程 } } break; case 5: if (Tm.ElapsedMilliseconds >= 200) //夹紧延时后 { TaskMain.TrayJump.Start(Pos_TrayX, Pos_PutY, Pos_PutZ); //跳到放料位 LG.StepNext(6); } break; case 6: if (TaskMain.TrayJump.GetSta() == 0) //等待跳跃完成 { DeviceRsDef.Q_TakeClamp.OFF(); //张开夹爪 DeviceRsDef.Q_TrayAdjustX.ON(); //矫正X夹紧 DeviceRsDef.Q_TrayAdjustY.ON(); //矫正Y夹紧 Tm.Restart(); //开始计时 LG.StepNext(7); } break; case 7: if (Tm.ElapsedMilliseconds < 1000) //1s内检测夹爪张开信号 { if (DeviceRsDef.I_TakeClampOFF1.value && DeviceRsDef.I_TakeClampOFF2.value) //夹爪张开信号正常 { DeviceRsDef.Ax_TakeZ.MC_MoveAbs(TaskMain.TrayJump.Pos_SafeZ); //取料Z上到安全位 LG.StepNext(8); } } else //1s后信号还是不正常 { if (!DeviceRsDef.I_TakeClampOFF1.value) //1号夹爪张开未到位 { MessageBox.Show("1号上料夹爪张开未到位,请检查气缸张开传感器", "警告"); } if (!DeviceRsDef.I_TakeClampOFF2.value) //2号夹爪张开未到位 { MessageBox.Show("2号上料夹爪张开未到位,请检查气缸张开传感器", "警告"); } Tm.Restart(); //重新计时 //切换到停止状态 } break; case 8: if (!DeviceRsDef.Ax_TakeZ.busy) //取料Z上到位 { Tm.Restart(); //开始计时 LG.StepNext(9); } break; case 9: if (Tm.ElapsedMilliseconds < 100) //100ms内检测载台Tray盘信号 { if ((DeviceRsDef.I_PutInp1.value || !TaskMain.LogicMain.GroupEn[0]) && //1号载台Tray盘信号正常 (DeviceRsDef.I_PutInp2.value || !TaskMain.LogicMain.GroupEn[1])) //2号载台Tray盘信号正常 { OK = true; //标志流程完成 LG.End(); } } else //100ms后信号还是不正常 { if (MessageBox.Show("检测到载台Tray盘异常,点击后将继续运行\n\r\n\r是:人工调整或补齐载台Tray盘\n\r\n\r否:取走载台Tray盘,重新上料", "警告", MessageBoxButtons.YesNo) == DialogResult.Yes) { Tm.Restart(); //人工选是后重新计时判断信号 } else { LG.StepNext(1); //人工选否后重新取Tray盘 } } break; case 0xe0: if (!DeviceRsDef.Ax_TakeZ.busy) { //切换状态到停止 OK = false; //标志流程未完成 LG.End(); } break; } }
protected override void LogicImpl() { switch (LG.Step) { case 1: if (!TaskMain.WaferSeek.Ok) { TaskMain.WaferSeek.Start(); } else { TaskMain.PickJump.Start(TaskMain.PickJump.Ready); } LG.StepNext(2); break; case 2: if (TaskMain.WaferSeek.GetSta() == 0) { if (TaskMain.WaferSeek.Ok) { LG.StepNext(3); } else { LG.End(); } } break; case 3: if (TaskMain.PickJump.GetSta() == 0) { TaskMain.PickJump.Start(Pos_Take); LG.StepNext(4); } break; case 4: if (DeviceRsDef.Ax_PickY.currPos <= TaskMain.PickJump.Ready.Y) { DeviceRsDef.Q_PickBlow.OFF(); DeviceRsDef.Q_PickVacuo.ON(); LG.StepNext(5); } break; case 5: if (TaskMain.PickJump.GetSta() == 0) { DeviceRsDef.Q_NeedleVacuo.ON(); DeviceRsDef.Ax_Needle.MC_MoveAbs(Pos_NeedleUp); DeviceRsDef.Ax_PickZ.MC_MoveAbs(Spd_ReturnZ, Pos_Take.Z - Pos_ReturnZ); LG.StepNext(6); } break; case 6: if (!DeviceRsDef.Ax_Needle.busy && !DeviceRsDef.Ax_PickZ.busy) { Tm.Restart(); LG.StepNext(7); } break; case 7: if (Tm.ElapsedMilliseconds >= TaskMain.PickTake.Tim_Take) { DeviceRsDef.Ax_Needle.MC_MoveAbs(Pos_NeedleDown); DeviceRsDef.Ax_PickZ.MC_MoveAbs(TaskMain.PickJump.Ready.Z); } break; } }
protected override void LogicImpl() { var ProcessData = ProjectData.Instance.SaveData.processdata; switch (LG.Step) { case 1: //RZ到位 ProcessData.SolderList[ID].Clear(); if (Axis.SolderR[ID].status == 0 && Axis.SolderZ[ID].status == 0) { NUM = 0; Axis.SolderR[ID].MC_MoveAbs(0); Axis.SolderZ[ID].MC_MoveAbs(ProjectData.Instance.SaveData.SolderData[ID].SafeZ); LG.ImmediateStepNext(2); } break; case 2: //XY到位 if (Axis.SolderR[ID].status == 0 && Axis.SolderZ[ID].status == 0) { if (ProjectData.Instance.SaveData.processdata.SolderCTPos[ID][NUM].Ban) { NUM++; break; } Axis.SolderX[ID].MC_MoveAbs(ProcessData.SolderCTPos[ID][NUM].X); Axis.SolderY[ID].MC_MoveAbs(ProcessData.SolderCTPos[ID][NUM].Y); LG.ImmediateStepNext(3); } break; case 3: //拍照 if (Axis.SolderX[ID].status == 0 && Axis.SolderY[ID].status == 0 && LG.Delay(ProjectData.Instance.SaveData.SolderData[ID].CTDelay)) { LG.ImmediateStepNext(4); } break; case 4: //获取相机数据 if (/*VisionProject.Instance.visionApi.TrigComplete()||*/ TaskManager.Default.FSM.MODE == 1) { if (TaskManager.Default.FSM.MODE == 1) { SolderPosData _pos = new SolderPosData(); _pos.Pos.X = ProjectData.Instance.SaveData.processdata.SolderCTPos[ID][NUM].X; _pos.Pos.Y = ProjectData.Instance.SaveData.processdata.SolderCTPos[ID][NUM].Y; _pos.Pos.R = 0; if (ProjectData.Instance.SaveData.processdata.Agingdataforsolder == null) { ProjectData.Instance.SaveData.processdata.Agingdataforsolder = new SolderDef(); } ProjectData.Instance.SaveData.processdata.Agingdataforsolder.Z = 25; _pos.Pos = IOandAxisFun.CameraToSolderPos(ID, _pos.Pos); _pos.SolderData = ProjectData.Instance.SaveData.processdata.Agingdataforsolder; ProcessData.SolderList[ID].Add(_pos); //增加到list里 NUM++; if (NUM < ProjectData.Instance.SaveData.processdata.SolderCTPos[ID].Count) { LG.ImmediateStepNext(2); //还有打磨拍照点继续打磨i拍照 } else { NUM = 0; LG.ImmediateStepNext(5); } } else if (true) { foreach (var p in VisionInteraction.Instance.WhichSolder(ID).listModel) { int type = p.modelindex; int num = 0; foreach (var item in ProjectData.Instance.SaveData.processdata.WhichSolderMedol(ID)) { float Tx = 0; float Ty = 0; float Tr = 0; float x = 0; float y = 0; float cAng = (float)(p.ListPos[num].R * Math.PI / 180); if (ProjectData.Instance.SaveData.SolderPlatform[ID].UseR) //使用旋转中心 { x = p.ModelPos.X + ProjectData.Instance.SaveData.processdata.SolderCTPos[ID][NUM].X; y = p.ModelPos.Y + ProjectData.Instance.SaveData.processdata.SolderCTPos[ID][NUM].Y; IOandAxisFun.Transorm(ID, x, y, x + p.ListPos[num].X, y + p.ListPos[num].Y, cAng, out Tx, out Ty); } else { Tx = p.ListPos[num].X + ProjectData.Instance.SaveData.processdata.SolderCTPos[ID][NUM].X; Ty = p.ListPos[num].Y + ProjectData.Instance.SaveData.processdata.SolderCTPos[ID][NUM].Y; Tr = 0; } SolderPosData _pos = new SolderPosData(); _pos.Pos.X = Tx; _pos.Pos.Y = Ty; _pos.Pos.R = Tr; _pos.Pos = IOandAxisFun.CameraToSolderPos(ID, _pos.Pos); _pos.SolderData = ProjectData.Instance.SaveData.processdata.WhichSolderMedol(ID)[type].solderdata[num].Clone(); num++; SolderOrderList.Add(_pos); //增加到list里 } } foreach (SolderPosData data in SolderOrderList.OrderBy(a => a.Pos.X).ThenBy(a => a.Pos.Y)) //排序 { ProcessData.SolderList[ID].Add(data); //加到上锡位置 } NUM++; if (ProcessData.SolderCTPos[ID].Count() > NUM) { LG.ImmediateStepNext(2); //去下一个拍照位置 } else { LG.ImmediateStepNext(5); } } } break; case 5: //判断上锡列表里的数据 if (ProcessData.SolderList[ID].Count() > 0) { LG.ImmediateStepNext(0xef); } else if (TaskManager.Default.FSM.MODE == 1) { LG.ImmediateStepNext(0xef); } else { string mes = ID.ToString() + "平台无上锡点"; MachineAlarm.SetAlarm(AlarmLevelEnum.Level2, mes); LG.StepNext(0xef, FSMStaDef.RUN); } break; case 0xef: //结束 LG.End(); break; } }
protected override void LogicImpl() { switch (LG.Step) { case 1: if (TaskMain.StackUnload.GetSta() == 0) //等上次的堆叠定位结束 { if (!TaskMain.StackUnload.Finish) //堆叠还没用完 { DeviceRsDef.Q_TakeClamp.OFF(); //上料夹爪张开 Tm.Restart(); //开始计时 LG.StepNext(2); } else //堆叠用完 { DeviceRsDef.Ax_TakeZ.MC_MoveAbs(TaskMain.TrayJump.Pos_SafeZ); //取料Z到安全位 LG.StepNext(0xE0); //到异常结束 } } break; case 2: if (Tm.ElapsedMilliseconds < 1000) //1000ms内检测信号OK { if (DeviceRsDef.I_TakeClampOFF1.value && //1号夹爪张开到位 DeviceRsDef.I_TakeClampOFF2.value && //2号夹爪召开到位 (TaskMain.LogicMain.GroupEn[0] && DeviceRsDef.I_PutInp1.value) && //1号载台正常 (TaskMain.LogicMain.GroupEn[1] && DeviceRsDef.I_PutInp2.value)) //2号载台正常 { TaskMain.TrayJump.Start(Pos_TrayX, Pos_TakeY, Pos_TakeZ); //取料平台到取料位 LG.StepNext(3); } } else //1000ms后信号还是不正常 { //载台信号异常 if ((TaskMain.LogicMain.GroupEn[0] && !DeviceRsDef.I_PutInp1.value) || (TaskMain.LogicMain.GroupEn[1] && !DeviceRsDef.I_PutInp2.value)) { if (MessageBox.Show("载台Tray盘信号丢失\n\r\n\r确定:请人工调整载台Tray盘,继续下料\n\r\n\r取消:人工取走载台Tray盘,结束下料", "警告", MessageBoxButtons.OK) == DialogResult.OK) { //切换到停止状态 LG.StepNext(1); } } else if (!DeviceRsDef.I_TakeClampOFF1.value || //1号爪张开未到位 !DeviceRsDef.I_TakeClampOFF2.value) //2号爪张开未到位 { MessageBox.Show("检测到取Tray盘夹爪张开未到位", "警告"); LG.End(); } } break; case 3: if (TaskMain.TrayJump.GetSta() == 0) //等待取料平台跳跃完成 { DeviceRsDef.Q_TakeClamp.ON(); DeviceRsDef.Q_TrayAdjustX.OFF(); DeviceRsDef.Q_TrayAdjustY.OFF(); Tm.Restart(); //开始计时 LG.StepNext(4); } break; case 4: if (Tm.ElapsedMilliseconds >= 200) //夹紧延时后 { TaskMain.TrayJump.Start(Pos_TrayX, Pos_PutY, Pos_PutZ); //跳到放料位 LG.StepNext(5); } break; case 5: if (TaskMain.TrayJump.GetSta() == 0) //等待跳跃完成 { DeviceRsDef.Q_TakeClamp.OFF(); Tm.Restart(); LG.StepNext(6); } break; case 6: if (Tm.ElapsedMilliseconds < 1000) { if (DeviceRsDef.I_TakeClampOFF1.value && //1号夹爪张开到位 DeviceRsDef.I_TakeClampOFF2.value && //2号夹爪召开到位 (TaskMain.LogicMain.GroupEn[0] && DeviceRsDef.I_TakeInp1.value) && //1号Tray盘下料正常 (TaskMain.LogicMain.GroupEn[1] && DeviceRsDef.I_TakeInp2.value)) //2号Tray盘下料正常 { DeviceRsDef.Ax_TakeZ.MC_MoveAbs(TaskMain.TrayJump.Pos_SafeZ); //Z到安全高度 LG.StepNext(7); } } else { DeviceRsDef.Ax_TakeZ.MC_MoveAbs(TaskMain.TrayJump.Pos_SafeZ); //Z到安全 MessageBox.Show("抓取信号丢失,Tray盘掉落"); LG.StepNext(7); } break; case 7: if (!DeviceRsDef.Ax_TakeZ.busy) //等待Z上到位 { OK = true; LG.End(); } break; } }
protected override void LogicImpl() { var Para = Product.Inst; switch (LG.Step) { case 1: whichMark = 0; Para.ProcessData.currWhichProduct = 0; //第一个产品 LG.StepNext(2); break; case 2: for (int i = 0; i < CTRCard.Axis_Z.Count; i++) { CTRCard.Axis_Z[i].MC_MoveAbs(Para.Stickdata.ZSafePos); //两个Z轴抬起到安全高度 } LG.StepNext(3); break; case 3: if (CTRCard.ZArrive) //Z轴到达 { stickPos = Product.Inst.Stickdata.TrayData.ProductList[0].Clone(); //把产品树里的产品参数克隆过来 LG.StepNext(4); } break; case 4: CTRCard.Axis_X.MC_MoveAbs(Product.Inst.Stickdata.TrayData.ProductList[0].MarkPoint[whichMark].X); //XY到位 CTRCard.Axis_Y.MC_MoveAbs(Product.Inst.Stickdata.TrayData.ProductList[0].MarkPoint[whichMark].Y); DeviceRsDef.Q_UpLighSource.ON(); //上光源打开 LG.StepNext(5); break; case 5: if (CTRCard.XYArrive && LG.Delay(Para.Stickdata.CTDelay)) //XY到达 { TaskMain.UpCamLogc.ModelID = whichMark; TaskMain.UpCamLogc.Triger(); LG.StepNext(6); } break; case 6: if (TaskMain.UpCamLogc.Finish) { if (TaskMain.UpCamLogc.Result.Count > 0) { LG.StepNext(7); } else { LG.StepNext(8); } } break; case 7: PointF3Vision mark = new PointF3Vision(); mark.X = Product.Inst.Stickdata.TrayData.ProductList[0].MarkPoint[whichMark].X + TaskMain.UpCamLogc.Result[0].X; mark.Y = Product.Inst.Stickdata.TrayData.ProductList[0].MarkPoint[whichMark].Y + TaskMain.UpCamLogc.Result[0].Y; mark.R = Product.Inst.Stickdata.TrayData.ProductList[0].MarkPoint[whichMark].R + TaskMain.UpCamLogc.Result[0].R; VisionProject.Instance.Tool.PointLocation.SetBenchmark1(whichMark, mark.X, mark.Y); VisionProject.Instance.Tool.PointLocation.SetBenchmark2(whichMark, mark.X, mark.Y); whichMark++; if (whichMark >= 2) { VisionProject.Instance.Tool.PointLocation.Calculation(); Product.Inst.Stickdata.TrayData.ProductList[0] = MarkCaculate(Product.Inst.Stickdata.TrayData.ProductList[0]); LG.StepNext(8); } else { LG.StepNext(4); } break; case 8: LG.StepNext(0xef); break; case 0xef: LG.End(); break; } }
protected override void LogicImpl() { var Para = Product.Inst; switch (LG.Step) { case 1: //Z轴抬起到安全高度 if (Para.ProcessData.currWhichProduct >= Para.ProcessData.StickPosList.Count) { Para.ProcessData.currWhichProduct = 0; } else { if (Para.ProcessData.currWhichPoint >= Para.ProcessData.CurrStickWhichProduct().SiteList.Count) { Para.ProcessData.currWhichPoint = 0; } } if (Para.ProcessData.StickPosList.Count == 0) { Alarm.SetAlarm(AlarmLevelEnum.Level2, "没扫Mark点,不允许贴附"); LG.StepNext(0xef); } else { if (CTRCard.ZArrive) { for (int i = 0; i < 2; i++) { CTRCard.Axis_Z[i].MC_MoveAbs(Para.Stickdata.ZSafePos); } LG.StepNext(2); } } break; case 2: bool isCanStick = false; for (int i = 0; i < 2; i++) //扫描吸嘴个数 { if (Para.ProcessData.NuzzlePara[i].isOk == 1 && Para.ProcessData.NuzzlePara[i].isHave) { whichNuzzle = i; isCanStick = true; break; } } if (isCanStick) { StickPos(whichNuzzle); Para.ProcessData.NuzzlePara[whichNuzzle].isHave = false; Para.ProcessData.NuzzlePara[whichNuzzle].isOk = 0; LG.StepNext(3); } else { LG.StepNext(0xef); } break; case 3: //xy到贴标位置 if (CTRCard.ZArrive) { CTRCard.Axis_X.MC_MoveAbs(stickPos.X); CTRCard.Axis_Y.MC_MoveAbs(stickPos.Y); CTRCard.Axis_R[whichNuzzle].MC_MoveAbs(stickPos.R); LG.StepNext(4); } break; case 4: //系统稳定时间+第一段快速下降 if (CTRCard.XYArrive && CTRCard.RArrive && LG.TCnt(10)) { CTRCard.Axis_Z[whichNuzzle].MC_MoveAbs(stickPos.Z - 5); LG.StepNext(5); } break; case 5: //第二段慢速下降 if (CTRCard.ZArrive) { CTRCard.Axis_Z[whichNuzzle].MC_MoveAbs(30, stickPos.Z); LG.StepNext(6); } break; case 6: //到达贴标高度吸真空打开,吹气关闭 if (CTRCard.ZArrive) { CTRCard.Q_Nuzzle[whichNuzzle].ON(); CTRCard.Q_Blow[whichNuzzle].OFF(); LG.StepNext(7); } break; case 7: //真空延时后,很空关闭,吹气打开 if (LG.Delay(Para.Stickdata.StickPara.SuckOffDelay)) { CTRCard.Q_Nuzzle[whichNuzzle].OFF(); CTRCard.Q_Blow[whichNuzzle].ON(); LG.StepNext(8); } break; case 8: //吹气延时后吹气关闭 if (LG.Delay(Para.Stickdata.StickPara.SuckBlowDelay)) { CTRCard.Q_Blow[whichNuzzle].OFF(); Product.Inst.ProductYield.ProductCount(); //产量+1用于计算UPH LG.StepNext(9); } break; case 9: //Z轴回到安全位 if (CTRCard.ZArrive) { CTRCard.Axis_Z[whichNuzzle].MC_MoveAbs(Para.Stickdata.ZSafePos); LG.StepNext(10); } break; case 10: //Z轴到位后 if (CTRCard.Axis_Z[whichNuzzle].status == AxState.AXSTA_READY) { CTRCard.Axis_R[whichNuzzle].MC_MoveAbs(0); LG.StepNext(11); } break; case 11: Para.ProcessData.currWhichPoint++; //点位++ if (Para.ProcessData.currWhichPoint >= Para.ProcessData.StickPosList[Para.ProcessData.currWhichProduct].SiteList.Count) { Para.ProcessData.currWhichPoint = 0; //点位置0 Para.ProcessData.currWhichProduct++; //产品加1 if (Para.ProcessData.currWhichProduct >= Para.ProcessData.StickPosList.Count) { //Para.ProcessData.currWhichPoint = 0;//点位置0 //Para.ProcessData.currWhichProduct = 0;//产品置0 LG.StepNext(0xef); break; } } LG.StepNext(2); if (!Para.ProcessData.NuzzlePara[0].isHave && !Para.ProcessData.NuzzlePara[1].isHave) { LG.StepNext(0xef); //两个吸嘴都没有料就结束 } break; case 0xef: LG.End(); break; } }
protected override void LogicImpl() { switch (LG.Step) { case 1: TaskMain.prefeed.Start(); TaskMain.sticklogic.Start(); LG.StepNext(2); break; case 2: if (TaskMain.prefeed.GetDone && TaskMain.feedout.GetDone && TaskManager.Default.FSM.Status.ID == FSMStaDef.RUN ) { LG.StepNext(3); } break; case 3: TaskMain.feed.Start(); LG.StepNext(4); break; case 4: if (TaskMain.feed.GetDone && TaskManager.Default.FSM.Status.ID == FSMStaDef.RUN) { LG.StepNext(5); } break; case 5: TaskMain.prefeed.Start(); LG.StepNext(6); break; case 6: if (TaskMain.sticklogic.GetDone) { LG.StepNext(7); } break; case 7: if (TaskMain.feedout.GetDone) { TaskMain.feedout.Start(); LG.StepNext(8); } break; case 8: if (DeviceRsDef.I_BeltFeedIn.Value == false && DeviceRsDef.I_BeltFeedOut.Value == false && TaskManager.Default.FSM.Status.ID == FSMStaDef.RUN) { LG.StepNext(1); } else { LG.StepNext(0xef); } break; case 0xef: LG.End(); break; } }
protected override void LogicImpl() { switch (LG.Step) { case 1: startNuzzleParaInit(); for (int i = 0; i < 30; i++) { DeviceRsDef.MotionCard.MotionFun.OutputOFF(i); } DeviceRsDef.MotionCard.MotionFun.OutputON(24); for (int i = 0; i < DeviceRsDef.AxisList.Count; i++) { DeviceRsDef.AxisList[i].MC_Stop(); } Alarm.ClearAlarm(); if (DeviceRsDef.I_XFarLimit.Value) { DeviceRsDef.Axis_X.MC_Stop(); Alarm.SetAlarm(AlarmLevelEnum.Level3, "X正硬极限限位"); } if (DeviceRsDef.I_YFarLimit.Value) { DeviceRsDef.Axis_Y.MC_Stop(); Alarm.SetAlarm(AlarmLevelEnum.Level3, "Y正硬极限限位"); } Product.Inst.ProcessData.currWhichPoint = 0; Product.Inst.ProcessData.currWhichProduct = 0; LG.StepNext(2); break; case 2: if (LG.Delay(100)) { for (int i = 0; i < DeviceRsDef.AxisList.Count; i++) { DeviceRsDef.AxisList[i].MC_AlarmReset(); } LG.StepNext(3); } break; case 3: if (CTRCard.ZArrive) { DeviceRsDef.Axis_Z1.MC_Home(); DeviceRsDef.Axis_Z2.MC_Home(); LG.StepNext(4); } break; case 4: if (CTRCard.ZArrive) { DeviceRsDef.Axis_R1.MC_Home(); DeviceRsDef.Axis_R2.MC_Home(); DeviceRsDef.Axis_X.MC_Home(); DeviceRsDef.Axis_Y.MC_Home(); LG.StepNext(5); } break; case 5: if (CTRCard.XYArrive && CTRCard.RArrive) { LG.StepNext(0xef); } break; case 0xef: LG.End(); FSM.Stop(); break; } }
protected override void LogicImpl() { //放晶时循环处理提前控制真空和吹气 if (LG.Execute == true) { if (Tr.TrigOne(System.Math.Abs(DeviceRsDef.Ax_PickZ.currPos - Pos_Put.Z) <= Pos_Ahead, 0)) //当Z位置进入到提前范围内时,执行一次 { DeviceRsDef.Q_PickVacuo.OFF(); //关真空 DeviceRsDef.Q_PickBlow.ON(); //开吹气 } } switch (LG.Step) { case 1: if (!DeviceRsDef.Q_PickVacuo.Value || !DeviceRsDef.I_PickVacuo.value) //如果没取好片 { TaskMain.PickTake.Start(); //执行取片 } LG.StepNext(2); break; case 2: if (DeviceRsDef.Q_PickVacuo.Value && DeviceRsDef.I_PickVacuo.value) //如果取好片了 { FPointXYZR p = Pos_Put.Clone(); //取放晶点位置 p.Z = Pos_Put.Z - Pos_Slow; //Z修改为慢速点 TaskMain.PickJump.Start(p, true, TaskMain.PickJump.Pos_PreInpZ); //跳跃到放晶点的慢速高度,检测真空,Z带提前量 LG.StepNext(3); } else //如果没取好片 { LG.End(); //结束流程 } break; case 3: if (TaskMain.PickJump.GetSta() == 0) //跳跃结束 { if (TaskMain.PickJump.VacuoResult) //真空检测OK { DeviceRsDef.Ax_PickZ.MC_MoveAbs(Spd_Slow, Pos_Put.Z); //Z慢速到放晶位 LG.StepNext(4); } else //真空异常 { //要报警 PutOk = false; //标志放晶失败 LG.End(); } } break; case 4: if (!DeviceRsDef.Ax_PickZ.busy) //等待Z到位 { //DeviceRsDef.Q_PickVacuo.OFF();//由提前量控制吹气和真空 //DeviceRsDef.Q_PickBlow.ON(); Tm.Restart(); //到位开始计时 LG.StepNext(5); } break; case 5: if (Tm.ElapsedMilliseconds >= Tim_Put) //放晶时间到 { DeviceRsDef.Q_PickBlow.OFF(); //关闭吹气 TaskMain.PickTake.Start(); //取晶 TaskMain.TrayDesk.Start(Pos_Check); //相机移动到该点 LG.StepNext(6); } break; case 6: if (TaskMain.TrayDesk.GetSta() == 0 && DeviceRsDef.Ax_PickY.currPos < TaskMain.PickJump.Ready.Y + 1) { VisionSot = true; //触发视觉 LG.StepNext(7); } break; case 7: if (!VisionSot) //等待视觉结束 { PutOk = VisionRet; //标志放晶结果 LG.End(); } break; } }
protected override void LogicImpl() { var para = ProjectData.Instance.SaveData.SolderPlatform[ID]; switch (LG.Step) { case 1: //平台到位 stick1SpendTime.Restart(); if (Axis.SolderPlatFormIsHave[ID].value && ProjectData.Instance.SaveData.processdata.PlatformData[ID * 4 + 1].IsHave && ProjectData.Instance.SaveData.processdata.PlatformData[ID * 4 + 1].IsPolished || TaskManager.Default.FSM.MODE == 1) { LG.ImmediateStepNext(2); } else { string mes = ID.ToString() + "平台未有料或未打磨"; MachineAlarm.SetAlarm(AlarmLevelEnum.Level2, mes); LG.StepNext(2, FSMStaDef.RUN); } break; case 2: //开始上锡拍照 if (DeviceRsDef.I_CylLocked.value || TaskManager.Default.FSM.MODE == 1) { SolderCT.Start(); LG.ImmediateStepNext(3); } break; case 3: //开始上锡 if (SolderCT.GetSta() == 0 && SolderClean.GetSta() == 0) { Solder.Start(); LG.ImmediateStepNext(4); } break; case 4: //上锡结束是否清洗 if (Solder.GetSta() == 0 && ProjectData.Instance.SaveData.SolderData[ID].SolderNum % para.PerTimesClean == 0 && ProjectData.Instance.SaveData.processdata.SolderList[ID].Count() > 0) { ProjectData.Instance.SaveData.SolderData[ID].SolderNum = 0; SolderClean.Start(); LG.ImmediateStepNext(3); para.SolderSum++; } else if (Solder.GetSta() == 0 && ProjectData.Instance.SaveData.processdata.SolderList[ID].Count() > 0) { LG.ImmediateStepNext(3); para.SolderSum++; } else if (Solder.GetSta() == 0 && ProjectData.Instance.SaveData.processdata.SolderList[ID].Count() == 0) { SolderClean.Start(); LG.ImmediateStepNext(5); } break; case 5: //ZR回到既定高度 if (Axis.SolderZ[ID].status == 0 && Axis.SolderR[ID].status == 0 && SolderClean.GetSta() == 0) { Axis.SolderZ[ID].MC_MoveAbs(para.EndPos.Z); Axis.SolderR[ID].MC_MoveAbs(para.EndPos.R); LG.ImmediateStepNext(6); } break; case 6: //ZR回到既定高度 if (Axis.SolderZ[ID].status == 0 && Axis.SolderR[ID].status == 0) { Axis.SolderX[ID].MC_MoveAbs(para.EndPos.X); Axis.SolderY[ID].MC_MoveAbs(para.EndPos.Y); LG.ImmediateStepNext(0xef); } break; case 0xef: if (Axis.SolderX[ID].status == 0 && Axis.SolderY[ID].status == 0) { LG.End(); stick1SpendTime.Stop(); para.SolderSpendTime = stick1SpendTime.ElapsedMilliseconds; ProjectData.Instance.SaveData.processdata.PlatformData[ID * 4 + 1].IsTined = true; } break; } }
protected override void LogicImpl() { var ProcessData = ProjectData.Instance.SaveData.processdata; switch (LG.Step) { case 1: //上锡列表里是否有上锡点 if (ProcessData.SolderList[ID].Count() > 0) { LG.ImmediateStepNext(2); } else if (TaskManager.Default.FSM.MODE == 1) { LG.ImmediateStepNext(0xef); } else { string mes = ID.ToString() + "平台无焊锡点"; MachineAlarm.SetAlarm(AlarmLevelEnum.Level2, mes); LG.StepNext(0xef, FSMStaDef.RUN); } break; case 2: //RZ抬高 if (Axis.SolderR[ID].status == 0 && Axis.SolderZ[ID].status == 0) { Axis.SolderR[ID].MC_MoveAbs(0); Axis.SolderZ[ID].MC_MoveAbs(ProjectData.Instance.SaveData.SolderData[ID].SafeZ); LG.ImmediateStepNext(3); } break; case 3: //XY到第一个上锡点位 if (Axis.SolderR[ID].status == 0 && Axis.SolderZ[ID].status == 0) { Axis.SolderX[ID].MC_MoveAbs(ProcessData.SolderList[ID][0].Pos.X); Axis.SolderY[ID].MC_MoveAbs(ProcessData.SolderList[ID][0].Pos.Y); LG.ImmediateStepNext(4); } break; case 4: //第一段送锡 if (Axis.SolderX[ID].status == 0 && Axis.SolderY[ID].status == 0) { Axis.SolderS[ID].MC_MoveRel(ProcessData.SolderList[ID][0].SolderData.FrontSpeed, ProcessData.SolderList[ID][0].SolderData.FrontLen); Axis.SolderS[ID + 1].MC_MoveRel(ProcessData.SolderList[ID][0].SolderData.FrontSpeed, ProcessData.SolderList[ID][0].SolderData.FrontLen); LG.ImmediateStepNext(5); } break; case 5: //第一段退锡 if (Axis.SolderS[ID].status == 0) { Axis.SolderS[ID].MC_MoveRel(ProcessData.SolderList[ID][0].SolderData.BsckSpeed, ProcessData.SolderList[ID][0].SolderData.BackLen); Axis.SolderS[ID + 1].MC_MoveRel(ProcessData.SolderList[ID][0].SolderData.BsckSpeed, ProcessData.SolderList[ID][0].SolderData.BackLen); LG.ImmediateStepNext(6); } break; case 6: //RZ到上锡点位 if (Axis.SolderS[ID].status == 0) { Axis.SolderR[ID].MC_MoveAbs(ProcessData.SolderList[ID][0].Pos.R); Axis.SolderZ[ID].MC_MoveAbs(ProcessData.SolderList[ID][0].SolderData.Z); LG.ImmediateStepNext(7); } break; case 7: //第二段送锡 if (Axis.SolderR[ID].status == 0 && Axis.SolderZ[ID].status == 0) { Axis.SolderS[ID].MC_MoveRel(ProcessData.SolderList[ID][0].SolderData.FrontSpeed2, ProcessData.SolderList[ID][0].SolderData.FrontLen2); Axis.SolderS[ID + 1].MC_MoveRel(ProcessData.SolderList[ID][0].SolderData.FrontSpeed2, ProcessData.SolderList[ID][0].SolderData.FrontLen2); LG.ImmediateStepNext(8); } break; case 8: //第二段退锡 if (Axis.SolderS[ID].status == 0) { Axis.SolderS[ID].MC_MoveRel(ProcessData.SolderList[ID][0].SolderData.BsckSpeed2, ProcessData.SolderList[ID][0].SolderData.BackLen2); Axis.SolderS[ID + 1].MC_MoveRel(ProcessData.SolderList[ID][0].SolderData.BsckSpeed2, ProcessData.SolderList[ID][0].SolderData.BackLen2); LG.ImmediateStepNext(9); } break; case 9: //第三段送锡 if (Axis.SolderS[ID].status == 0) { Axis.SolderS[ID].MC_MoveRel(ProcessData.SolderList[ID][0].SolderData.FrontSpeed3, ProcessData.SolderList[ID][0].SolderData.FrontLen3); Axis.SolderS[ID + 1].MC_MoveRel(ProcessData.SolderList[ID][0].SolderData.FrontSpeed3, ProcessData.SolderList[ID][0].SolderData.FrontLen3); LG.ImmediateStepNext(10); } break; case 10: //第三段退锡 if (Axis.SolderS[ID].status == 0) { Axis.SolderS[ID].MC_MoveRel(ProcessData.SolderList[ID][0].SolderData.BsckSpeed3, ProcessData.SolderList[ID][0].SolderData.BackLen3); Axis.SolderS[ID + 1].MC_MoveRel(ProcessData.SolderList[ID][0].SolderData.BsckSpeed3, ProcessData.SolderList[ID][0].SolderData.BackLen3); LG.ImmediateStepNext(11); } break; case 11: //判断是否开启抖动及抖动的模式 if (Axis.SolderS[ID].status == 0 && LG.Delay(1000)) { if (ProcessData.SolderList[ID][0].SolderData.Shake) { //开启抖动 switch (ProcessData.SolderList[ID][0].SolderData.mode) { //case 0: // LG.StepNext(12, FSMStaDef.RUN);//上下 // break; case 1: LG.ImmediateStepNext(13); //左右 break; case 2: LG.ImmediateStepNext(14); //前后 break; } } else { //不开启抖动 LG.ImmediateStepNext(15); } } break; #region 左右 case 13: Axis.SolderX[ID].MC_MoveRel(ProcessData.SolderList[ID][0].SolderData.speed, ProcessData.SolderList[ID][0].SolderData.interval); Axis.SolderZ[ID].MC_MoveRel(-ProcessData.SolderList[ID][0].SolderData.height / 3.0f); LG.ImmediateStepNext(131); break; case 131: if (Axis.SolderX[ID].status == 0 && Axis.SolderZ[ID].status == 0) { Axis.SolderX[ID].MC_MoveRel(ProcessData.SolderList[ID][0].SolderData.speed, -2 * ProcessData.SolderList[ID][0].SolderData.interval); Axis.SolderZ[ID].MC_MoveRel(-ProcessData.SolderList[ID][0].SolderData.height / 3.0f); LG.ImmediateStepNext(132); } break; case 132: if (Axis.SolderX[ID].status == 0 && Axis.SolderZ[ID].status == 0) { Axis.SolderX[ID].MC_MoveRel(ProcessData.SolderList[ID][0].SolderData.speed, ProcessData.SolderList[ID][0].SolderData.interval); Axis.SolderZ[ID].MC_MoveRel(-ProcessData.SolderList[ID][0].SolderData.height / 3.0f); LG.ImmediateStepNext(15); } break; #endregion #region 前后 case 14: Axis.SolderY[ID].MC_MoveRel(ProcessData.SolderList[ID][0].SolderData.speed, ProcessData.SolderList[ID][0].SolderData.interval); Axis.SolderZ[ID].MC_MoveRel(-ProcessData.SolderList[ID][0].SolderData.height / 3.0f); LG.ImmediateStepNext(141); break; case 141: if (Axis.SolderY[ID].status == 0 && Axis.SolderZ[ID].status == 0) { Axis.SolderY[ID].MC_MoveRel(ProcessData.SolderList[ID][0].SolderData.speed, -2 * ProcessData.SolderList[ID][0].SolderData.interval); Axis.SolderZ[ID].MC_MoveRel(-ProcessData.SolderList[ID][0].SolderData.height / 3.0f); LG.ImmediateStepNext(142); } break; case 142: if (Axis.SolderY[ID].status == 0 && Axis.SolderZ[ID].status == 0) { Axis.SolderY[ID].MC_MoveRel(ProcessData.SolderList[ID][0].SolderData.speed, ProcessData.SolderList[ID][0].SolderData.interval); Axis.SolderZ[ID].MC_MoveRel(-ProcessData.SolderList[ID][0].SolderData.height / 3.0f); LG.ImmediateStepNext(15); } break; #endregion case 15: //Z抬起到设定高度 if (Axis.SolderY[ID].status == 0 && Axis.SolderZ[ID].status == 0 && LG.Delay(ProjectData.Instance.SaveData.SolderPlatform[ID].TimeforTin)) { Axis.SolderZ[ID].MC_MoveRel(100, ProcessData.SolderList[ID][0].SolderData.LiftHeight); LG.ImmediateStepNext(16); } break; case 16: //移除第一个点 if (Axis.SolderZ[ID].status == 0) { ProjectData.Instance.SaveData.SolderData[ID].SolderNum++; ProcessData.SolderList[ID].RemoveAt(0); ProjectData.Instance.Product.ProductCount(); LG.ImmediateStepNext(0xef); } break; case 0xef: LG.End(); break; } }
protected override void LogicImpl() { var para = ProjectData.Instance.SaveData.PolishData[ID]; switch (LG.Step) { case 1: //RZ到拍照位 ProjectData.Instance.SaveData.processdata.PolishList[ID].Clear(); if (Axis.PolishR[ID].status == 0 && Axis.PolishZ[ID].status == 0) { NUM = 0; Axis.PolishR[ID].MC_MoveAbs(0); Axis.PolishZ[ID].MC_MoveAbs(para.SafeZ); LG.ImmediateStepNext(2); } break; case 2: //XY到拍照位 if (Axis.PolishR[ID].status == 0 && Axis.PolishZ[ID].status == 0) { if (ProjectData.Instance.SaveData.processdata.PolishCTPos[ID][NUM].Ban) { NUM++; break; } Axis.PolishX[ID].MC_MoveAbs(ProjectData.Instance.SaveData.processdata.PolishCTPos[ID][NUM].X); Axis.PolishY[ID].MC_MoveAbs(ProjectData.Instance.SaveData.processdata.PolishCTPos[ID][NUM].Y); LG.ImmediateStepNext(3); } break; case 3: //延时拍照 if (Axis.PolishX[ID].status == 0 && Axis.PolishY[ID].status == 0 && LG.Delay(para.CTDelay)) { LG.ImmediateStepNext(4); } break; case 4: //获取相机数据 if (/*VisionInteraction.Instance.TriggerCamera(ID)*/ true) { if (TaskManager.Default.FSM.MODE == 1) { PolishPosData _pos = new PolishPosData(); _pos.Pos.X = ProjectData.Instance.SaveData.processdata.PolishCTPos[ID][NUM].X; _pos.Pos.Y = ProjectData.Instance.SaveData.processdata.PolishCTPos[ID][NUM].Y; _pos.Pos.R = 0; //_pos.Pos = IOandAxisFun.CameraToPolisherPos(ID, _pos.Pos); if (ProjectData.Instance.SaveData.processdata.Agingdataforpolish == null) { ProjectData.Instance.SaveData.processdata.Agingdataforpolish = new PolishDef(); } _pos.Pos = IOandAxisFun.CameraToPolisherPos(ID, _pos.Pos); ProjectData.Instance.SaveData.processdata.Agingdataforpolish.Z = 20; _pos.polishData = ProjectData.Instance.SaveData.processdata.Agingdataforpolish; NUM++; ProjectData.Instance.SaveData.processdata.PolishList[ID].Add(_pos); if (NUM < ProjectData.Instance.SaveData.processdata.PolishCTPos[ID].Count) { LG.ImmediateStepNext(2); //还有打磨拍照点继续打磨i拍照 } else { NUM = 0; LG.ImmediateStepNext(5); } } else if (true) { foreach (var p in VisionInteraction.Instance.WhichPolish(ID).listModel) { int type = p.modelindex; int num = 0; foreach (var item in ProjectData.Instance.SaveData.processdata.WhichPolishMedol(ID)) { PolishPosData _pos = new PolishPosData(); _pos.Pos.X = p.ListPos[num].X + ProjectData.Instance.SaveData.processdata.PolishCTPos[ID][NUM].X; _pos.Pos.Y = p.ListPos[num].Y + ProjectData.Instance.SaveData.processdata.PolishCTPos[ID][NUM].Y; _pos.Pos.R = p.ListPos[num].R; _pos.polishData = ProjectData.Instance.SaveData.processdata.WhichPolishMedol(ID)[type].polishData[num].Clone(); _pos.Pos = IOandAxisFun.CameraToPolisherPos(ID, _pos.Pos); num++; PolishOrderList.Add(_pos); //增加到list里 } } foreach (PolishPosData data in PolishOrderList.OrderBy(a => a.Pos.X).ThenBy(a => a.Pos.Y)) //对list里的点进行排序 { ProjectData.Instance.SaveData.processdata.PolishList[ID].Add(data); //把排列好的点写进打磨list里 } if (NUM < ProjectData.Instance.SaveData.processdata.PolishCTPos[ID].Count) { LG.ImmediateStepNext(2); //还有打磨拍照点继续打磨i拍照 } else { NUM = 0; LG.ImmediateStepNext(5); } } } break; case 5: //判断打磨列表里的数据 if (ProjectData.Instance.SaveData.processdata.PolishList[ID].Count() > 0) { LG.ImmediateStepNext(0xef); } else if (TaskManager.Default.FSM.MODE == 1) { LG.ImmediateStepNext(0xef); } else { string mes = ID.ToString() + "平台没有打磨点"; MachineAlarm.SetAlarm(AlarmLevelEnum.Level2, mes); LG.StepNext(0xef, FSMStaDef.RUN); } break; case 0xef: //结束 LG.End(); break; } }
protected override void LogicImpl() { var Para = Product.Inst; LG.Start(); switch (LG.Step) { case 1: NuzzleParaInit(); LG.StepNext(2); CanMarkscan = true; break; case 2: feeder.Start(); if (Para.Stickdata.StickSysData.stright) { LG.StepNext(0xef); } else { Para.ProcessData.StickPosList.Clear(); Para.ProcessData.currWhichPoint = 0; Para.ProcessData.currWhichProduct = 0; for (int i = 0; i < Product.Inst.Stickdata.TrayData.ProductList.Count; i++) { Para.ProcessData.StickPosList.Add(Product.Inst.Stickdata.TrayData.ProductList[i].Clone()); } LG.StepNext(3); } break; case 3: if (feeder.GetDone) { takelabel.Start(); //取料 LG.StepNext(4); } break; case 4: if (takelabel.GetDone) { downCCD.Start(); //下相机拍照 LG.StepNext(5); } break; case 5: if (downCCD.GetDone) { bool isGiveUp = false; for (int i = 0; i < 2; i++) { //根据吸嘴上是否有料,并且下相机拍照NG,则满足弃料条件 if (Para.ProcessData.NuzzlePara[i].isOk != 1 && Para.ProcessData.NuzzlePara[i].isHave) { isGiveUp = true; } } if (isGiveUp) { giveup.Start(); feeder.Start(); LG.StepNext(101); break; } else { LG.StepNext(6); } feeder.Start(); } break; case 101: if (giveup.GetDone && feeder.GetDone) { LG.StepNext(3); } break; case 6: if (TaskMain.feed.GetDone && //暂时替代皮带流程 DeviceRsDef.I_BeltFeedIn.Value && TaskManager.Default.FSM.Status.ID == FSMStaDef.RUN || Product.Inst.IsAging ) { if (CanMarkscan) { markscan.Start(); LG.StepNext(7); CanMarkscan = false; } else { LG.StepNext(7); } } break; case 7: if (markscan.GetDone) { stick.Start(); LG.StepNext(8); } break; case 8: if (stick.GetDone) { if (Para.ProcessData.currWhichProduct >= Para.ProcessData.StickPosList.Count) { CanMarkscan = true; LG.StepNext(9); } else { LG.StepNext(102); } } break; case 102: LG.StepNext(3); break; case 9: scancode.Start(); LG.StepNext(10); break; case 10: if (scancode.GetDone) { LG.StepNext(11); } break; case 11: backCT.Start(); LG.StepNext(12); break; case 12: if (backCT.GetDone) { LG.StepNext(0xef); } break; case 0xef: if (Product.Inst.IsAging) { LG.StepNext(1); } else { LG.End(); } break; } }
protected override void LogicImpl() { var Para = Product.Inst.Stickdata; LG.Start(); switch (LG.Step) { case 1: whichProduct = 0; LG.StepNext(2); break; case 2: for (int i = 0; i < CTRCard.Axis_Z.Count; i++) { CTRCard.Axis_Z[i].MC_MoveAbs(0); } LG.StepNext(3); break; case 3: if (CTRCard.ZArrive) { if (Product.Inst.Stickdata.TrayData.ProductList.Count > 0) { LG.StepNext(4); } else { LG.StepNext(0xef); } } break; case 4: if (Para.CanBackCT) { CTRCard.Axis_X.MC_MoveAbs(TrayData.ProductList[whichProduct].BackCT.X); CTRCard.Axis_Y.MC_MoveAbs(TrayData.ProductList[whichProduct].BackCT.Y); LG.StepNext(5); } else { LG.StepNext(0xef); } break; case 5: if (CTRCard.XYArrive) { LG.StepNext(6); } break; case 6: if (CTRCard.XYArrive) { LG.StepNext(7); DeviceRsDef.Q_HoldLightCtrl.ON(); DeviceRsDef.Q_Light.OFF(); } break; case 7: if (LG.Delay(Para.CTDelay)) { //VisionProject.Instance.visionApi.TrigRun(3, 0); LG.StepNext(8); } break; case 8: if (Product.Inst.IsAging) { //老化模式下,不判断拍照结果 if (LG.TCnt(100)) { LG.StepNext(0xA0); } } else { //正常模式下 //if (VisionProject.Instance.visionApi.Trig == false) //{ // VisionProject.Instance.SaveBackCTFunImage(); // if (VisionProject.Instance.visionApi.Error == 0) // { // LG.StepNext(0xA0); // } // else // { // LG.StepNext(9); // } //} } break; case 0xA0: if (Product.Inst.IsAging) { LG.StepNext(9); } else { //ShowMessge.SendStartMsg(string.Format("产品{0}上物料精度 X:{1}Y:{2}R:{3}", whichProduct, VisionProject.Instance.visionApi.CheckStick[0].X, VisionProject.Instance.visionApi.CheckStick[0].Y, VisionProject.Instance.visionApi.CheckStick[0].R)); //ShowMessge.SendStartMsg(string.Format("产品{0}上物料精度 X:{1}Y:{2}R:{3}", whichProduct, VisionProject.Instance.visionApi.CheckStick[1].X, VisionProject.Instance.visionApi.CheckStick[1].Y, VisionProject.Instance.visionApi.CheckStick[1].R)); //ShowMessge.SendStartMsg(string.Format("产品{0}上物料精度 X:{1}Y:{2}R:{3}", whichProduct, VisionProject.Instance.visionApi.CheckStick[2].X, VisionProject.Instance.visionApi.CheckStick[2].Y, VisionProject.Instance.visionApi.CheckStick[2].R)); //ShowMessge.SendStartMsg(string.Format("产品{0}上物料精度 X:{1}Y:{2}R:{3}", whichProduct, VisionProject.Instance.visionApi.CheckStick[3].X, VisionProject.Instance.visionApi.CheckStick[3].Y, VisionProject.Instance.visionApi.CheckStick[3].R)); LG.StepNext(9); } break; case 9: whichProduct++; if (whichProduct >= TrayData.ProductList.Count) { LG.StepNext(0xef); } else { LG.StepNext(3); } break; case 0xef: LG.End(); break; } }
protected override void LogicImpl() { var Para = ProjectData.Instance.SaveData.PolishData[ID]; var ProcessData = ProjectData.Instance.SaveData.processdata; switch (LG.Step) { case 1: // 有打磨点 if (ProjectData.Instance.SaveData.processdata.PolishList[ID].Count() > 0) { LG.ImmediateStepNext(2); } else if (TaskManager.Default.FSM.MODE == 1) { LG.ImmediateStepNext(0xef); } else { string mes = ID.ToString() + "平台无打磨点"; MachineAlarm.SetAlarm(AlarmLevelEnum.Level2, mes); LG.StepNext(0xef, FSMStaDef.RUN); } break; case 2: //ZR抬高 if (Axis.PolishR[ID].status == 0 && Axis.PolishZ[ID].status == 0) { Axis.PolishR[ID].MC_MoveAbs(0); Axis.PolishZ[ID].MC_MoveAbs(Para.SafeZ); LG.ImmediateStepNext(3); } break; case 3: //到打磨点XY if (Axis.PolishR[ID].status == 0 && Axis.PolishZ[ID].status == 0) { PointPolishtimes = 0; Axis.PolishX[ID].MC_MoveAbs(ProcessData.PolishList[ID][0].Pos.X); Axis.PolishY[ID].MC_MoveAbs(ProcessData.PolishList[ID][0].Pos.Y); LG.ImmediateStepNext(4); } break; case 4: //到打磨点RZ if (Axis.PolishX[ID].status == 0 && Axis.PolishY[ID].status == 0) { Axis.PolishR[ID].MC_MoveAbs(ProcessData.PolishList[ID][0].Pos.R); Axis.PolishZ[ID].MC_MoveAbs(ProcessData.PolishList[ID][0].polishData.Z + Para.TotalReimburse); LG.ImmediateStepNext(5); } break; case 5: //判断打磨方式 if (Axis.PolishR[ID].status == 0 && Axis.PolishZ[ID].status == 0) { //打磨方式 switch (ProcessData.PolishList[ID][0].polishData.mode) { case 0: LG.ImmediateStepNext(6); //一字前后 break; case 1: LG.ImmediateStepNext(7); //一字左右 break; case 2: LG.ImmediateStepNext(8); //二字前后 break; case 3: LG.ImmediateStepNext(9); //二字左右 break; } } break; #region 一字前后 case 6: Axis.PolishY[ID].MC_MoveRel(ProcessData.PolishList[ID][0].polishData.GoBackRange); LG.ImmediateStepNext(61); break; case 61: if (Axis.PolishY[ID].status == 0) { Axis.PolishY[ID].MC_MoveRel(-2 * ProcessData.PolishList[ID][0].polishData.GoBackRange); LG.ImmediateStepNext(62); } break; case 62: if (Axis.PolishY[ID].status == 0) { Axis.PolishY[ID].MC_MoveRel(ProcessData.PolishList[ID][0].polishData.GoBackRange); LG.ImmediateStepNext(10); } break; #endregion #region 一字左右 case 7: Axis.PolishX[ID].MC_MoveRel(ProcessData.PolishList[ID][0].polishData.GoBackRange); LG.ImmediateStepNext(71); break; case 71: if (Axis.PolishX[ID].status == 0) { Axis.PolishX[ID].MC_MoveRel(-2 * ProcessData.PolishList[ID][0].polishData.GoBackRange); LG.ImmediateStepNext(72); } break; case 72: if (Axis.PolishX[ID].status == 0) { Axis.PolishX[ID].MC_MoveRel(ProcessData.PolishList[ID][0].polishData.GoBackRange); LG.ImmediateStepNext(10); } break; #endregion #region 二字前后 case 8: Axis.PolishY[ID].MC_MoveRel(ProcessData.PolishList[ID][0].polishData.GoBackRange); LG.ImmediateStepNext(81); break; case 81: if (Axis.PolishY[ID].status == 0) { Axis.PolishY[ID].MC_MoveRel(-2 * ProcessData.PolishList[ID][0].polishData.GoBackRange); LG.ImmediateStepNext(82); } break; case 82: if (Axis.PolishY[ID].status == 0) { Axis.PolishY[ID].MC_MoveRel(ProcessData.PolishList[ID][0].polishData.GoBackRange); LG.ImmediateStepNext(83); } break; case 83: if (Axis.PolishY[ID].status == 0) { Axis.PolishX[ID].MC_MoveRel(ProcessData.PolishList[ID][0].polishData.PolishInterval); Axis.PolishY[ID].MC_MoveRel(ProcessData.PolishList[ID][0].polishData.GoBackRange); LG.ImmediateStepNext(84); } break; case 84: if (Axis.PolishY[ID].status == 0 && Axis.PolishX[ID].status == 0) { Axis.PolishY[ID].MC_MoveRel(-2 * ProcessData.PolishList[ID][0].polishData.GoBackRange); LG.ImmediateStepNext(85); } break; case 85: if (Axis.PolishY[ID].status == 0) { Axis.PolishY[ID].MC_MoveRel(ProcessData.PolishList[ID][0].polishData.GoBackRange); LG.ImmediateStepNext(10); } break; #endregion #region 二字左右 case 9: Axis.PolishX[ID].MC_MoveRel(ProcessData.PolishList[ID][0].polishData.GoBackRange); LG.ImmediateStepNext(91); break; case 91: if (Axis.PolishX[ID].status == 0) { Axis.PolishX[ID].MC_MoveRel(-2 * ProcessData.PolishList[ID][0].polishData.GoBackRange); LG.ImmediateStepNext(92); } break; case 92: if (Axis.PolishX[ID].status == 0) { Axis.PolishX[ID].MC_MoveRel(ProcessData.PolishList[ID][0].polishData.GoBackRange); LG.ImmediateStepNext(93); } break; case 93: if (Axis.PolishX[ID].status == 0) { Axis.PolishY[ID].MC_MoveRel(ProcessData.PolishList[ID][0].polishData.PolishInterval); Axis.PolishX[ID].MC_MoveRel(ProcessData.PolishList[ID][0].polishData.GoBackRange); LG.ImmediateStepNext(94); } break; case 94: if (Axis.PolishX[ID].status == 0 && Axis.PolishY[ID].status == 0) { Axis.PolishX[ID].MC_MoveRel(-2 * ProcessData.PolishList[ID][0].polishData.GoBackRange); LG.ImmediateStepNext(95); } break; case 95: if (Axis.PolishX[ID].status == 0) { Axis.PolishX[ID].MC_MoveRel(ProcessData.PolishList[ID][0].polishData.GoBackRange); LG.ImmediateStepNext(10); } break; #endregion case 10: //判断打磨次数 PointPolishtimes++; if (ProcessData.PolishList[ID][0].polishData.GoBackTimes > PointPolishtimes && Axis.PolishX[ID].status == 0 && Axis.PolishY[ID].status == 0) { LG.ImmediateStepNext(5); //打磨次数未够,再次打磨 } else { PointPolishtimes = 0; LG.ImmediateStepNext(11); //打磨下一个点 } Para.SumPolishTimes++; //总的打磨次数用于更换打磨头 PolishTimes++; if (PolishTimes >= Para.Interval) //达到打磨补偿的次数 { PolishTimes = 0; Para.TotalReimburse += Para.Reimburse; } break; case 11: //移打磨列表里第一个点 if (Axis.PolishZ[ID].status == 0) { Para.PolishNum++; Axis.PolishZ[ID].MC_MoveAbs(ProcessData.PolishList[ID][0].polishData.LiftHeight); //抬起到设定高度 ProcessData.PolishList[ID].RemoveAt(0); LG.ImmediateStepNext(0xef); //打磨结束 } break; case 0xef: if (Axis.PolishZ[ID].status == 0) { LG.End(); } break; } }
protected override void LogicImpl() { var Para = Database.AllData.Data.Beltdata; switch (LG.Step) { case 1: DeviceRsDef.Q_Rise.OFF(); //顶升气缸不顶升 DeviceRsDef.Q_StopBlock.OFF(); //阻挡气缸不下降 if (DeviceRsDef.I_StopBlockUp.Value && DeviceRsDef.I_RiseDown.Value) //顶升气缸下限和阻挡气缸上限感应到 { LG.StepNext(2); } break; case 2: DeviceRsDef.Axis_BeltFeed.MC_MoveSpd(10); //中间皮带运行 DeviceRsDef.Axis_BeltPreFeed.MC_MoveSpd(10); //左侧皮带运行 LG.StepNext(3); break; case 3: if (fun.F_Trig(DeviceRsDef.I_BeltPreFeedOut.Value)) //载具已经脱离左侧皮带 { DeviceRsDef.Axis_BeltPreFeed.MC_StopDec(); //左侧皮带停止 LG.StepNext(4); } break; case 4: if (DeviceRsDef.I_BeltFeedIn.Value && LG.Delay(Para.RiseOnDelay)) //载具到位 { DeviceRsDef.Axis_BeltFeed.MC_StopDec(); //中间皮带停止 LG.StepNext(5); } break; case 5: if (DeviceRsDef.Axis_BeltFeed.status == 0) { DeviceRsDef.Q_Rise.ON(); //顶升气缸顶起固定 LG.StepNext(6); } break; case 6: if (DeviceRsDef.I_RiseUp.Value) //顶升气缸上限位 { DeviceRsDef.Q_StopBlock.ON(); //阻挡气缸 LG.StepNext(7); } break; case 7: if (DeviceRsDef.I_StopBlockDown.Value) //阻挡气缸下限到位 { LG.StepNext(0xef); } break; case 0xef: LG.End(); break; } }
protected override void LogicImpl() { var Para = Product.Inst; switch (LG.Step) { case 1: whichNuzzle = 0; LG.StepNext(2); break; case 2: if (Para.ProcessData.NuzzlePara[whichNuzzle].isHave) //吸嘴有料 { if (CTRCard.ZArrive) { for (int i = 0; i < CTRCard.Axis_Z.Count; i++) { CTRCard.Axis_Z[i].MC_MoveAbs(Para.Stickdata.ZSafePos); //到安全位置拍照 } LG.StepNext(3); } } else { LG.StepNext(6); //没有料换另一个吸嘴 } break; case 3: if (CTRCard.ZArrive) //到相应的吸嘴拍照位置 { if (Para.ProcessData.NuzzlePara[whichNuzzle].isHave && whichNuzzle == 0) { CTRCard.Axis_X.MC_MoveAbs(Para.Stickdata.StickSysData.LiftDownCCDPos.X); CTRCard.Axis_Y.MC_MoveAbs(Para.Stickdata.StickSysData.LiftDownCCDPos.Y); DeviceRsDef.Q_DownLighSource.ON(); LG.StepNext(4); } else if (Para.ProcessData.NuzzlePara[whichNuzzle].isHave && whichNuzzle == 1) { CTRCard.Axis_X.MC_MoveAbs(Para.Stickdata.StickSysData.RightDownCCDPos.X); CTRCard.Axis_Y.MC_MoveAbs(Para.Stickdata.StickSysData.RightDownCCDPos.Y); DeviceRsDef.Q_DownLighSource.ON(); LG.StepNext(4); } else { LG.StepNext(6); } } break; case 4: if (CTRCard.XYArrive && LG.Delay(Para.Stickdata.CTDelay)) { //VisionProject.Instance.visionApi.TrigRun(1, whichNuzzle);//触发拍照 LG.StepNext(5); } break; case 5: if (Product.Inst.IsAging) { if (LG.Delay(100)) { Para.ProcessData.NuzzlePara[whichNuzzle].isOk = 1; Para.ProcessData.NuzzlePara[whichNuzzle].CCDPos.X = 0; Para.ProcessData.NuzzlePara[whichNuzzle].CCDPos.Y = 0; Para.ProcessData.NuzzlePara[whichNuzzle].CCDPos.R = 0; LG.StepNext(6); } DeviceRsDef.Q_DownLighSource.OFF(); } else { //if (VisionProject.Instance.visionApi.TrigComplete() == true) //{ // var va = VisionProject.Instance.visionApi; // //判断拍照结果 // if (VisionProject.Instance.visionApi.Error == 0) // { // Para.ProcessData.NuzzlePara[whichNuzzle].isOk = 1; // Para.ProcessData.NuzzlePara[whichNuzzle].isHave = true; // Para.ProcessData.NuzzlePara[whichNuzzle].CCDPos.X = (float)VisionProject.Instance.visionApi.Result[0].X; // Para.ProcessData.NuzzlePara[whichNuzzle].CCDPos.Y = (float)VisionProject.Instance.visionApi.Result[0].Y; // Para.ProcessData.NuzzlePara[whichNuzzle].CCDPos.R = -(float)VisionProject.Instance.visionApi.Result[0].R; // DeviceRsDef.Q_DownLighSource.OFF(); // } // else // { // Para.ProcessData.NuzzlePara[whichNuzzle].isOk = 2; // } // LG.StepNext(6); //} } break; case 6: if (CTRCard.RArrive) { whichNuzzle++; if (whichNuzzle >= 2) { LG.StepNext(0xef); } else { LG.StepNext(2); } } break; case 0xef: LG.End(); break; } }
protected override void LogicImpl() { var Para = Product.Inst; switch (LG.Step) { case 1: whichMark = 0; //第一个mark点 Para.ProcessData.StickPosList.Clear(); //贴附过程列表清空 Para.ProcessData.currWhichPoint = 0; //第一个点 Para.ProcessData.currWhichProduct = 0; //第一个产品 MarkscanProduct = 0; MarkResult.Clear(); //mark点的拍照结果清空 whichProductAngle.Clear(); //机械角度列表清空 LG.StepNext(2); break; case 2: for (int i = 0; i < CTRCard.Axis_Z.Count; i++) { CTRCard.Axis_Z[i].MC_MoveAbs(Para.Stickdata.ZSafePos); //两个Z轴抬起到安全高度 } LG.StepNext(3); break; case 3: if (CTRCard.ZArrive) //Z轴到达 { if (Product.Inst.Stickdata.TrayData.ProductList.Count > 0) //产品树列表有产品 { LG.StepNext(4); stickPos = Product.Inst.Stickdata.TrayData.ProductList[MarkscanProduct].Clone(); //把产品树里的产品参数克隆过来 } else { LG.StepNext(0xef); } } break; case 4: CTRCard.Axis_X.MC_MoveAbs(Product.Inst.Stickdata.TrayData.ProductList[MarkscanProduct].MarkPoint[whichMark].X); //XY到位 CTRCard.Axis_Y.MC_MoveAbs(Product.Inst.Stickdata.TrayData.ProductList[MarkscanProduct].MarkPoint[whichMark].Y); DeviceRsDef.Q_UpLighSource.ON(); //上光源打开 //VisionProject.Instance.SetBenchmark1 // ( // Product.Inst.Stickdata.TrayData.ProductList[MarkscanProduct].MarkPoint[whichMark].X, // Product.Inst.Stickdata.TrayData.ProductList[MarkscanProduct].MarkPoint[whichMark].Y, // Product.Inst.Stickdata.TrayData.ProductList[MarkscanProduct].MarkPoint[whichMark].R, // whichMark,true // );//设置mark点识别位置 LG.StepNext(5); break; case 5: if (CTRCard.XYArrive && LG.Delay(Para.Stickdata.CTDelay)) //XY到达 { TaskMain.UpCamLogc.ModelID = whichMark; TaskMain.UpCamLogc.Triger(); LG.StepNext(6); } break; case 6: if (Product.Inst.IsAging) //老化模式 { if (LG.TCnt(200)) { LG.StepNext(7); } } else { if (TaskMain.UpCamLogc.Finish) { if (TaskMain.UpCamLogc.Result.Count > 0) { LG.StepNext(7); } else { LG.StepNext(8); } } } break; case 7: PointF3Vision mark = new PointF3Vision(); if (Product.Inst.IsAging) { mark.X = Product.Inst.Stickdata.TrayData.ProductList[MarkscanProduct].MarkPoint[whichMark].X; mark.Y = Product.Inst.Stickdata.TrayData.ProductList[MarkscanProduct].MarkPoint[whichMark].Y; mark.R = Product.Inst.Stickdata.TrayData.ProductList[MarkscanProduct].MarkPoint[whichMark].R; } else { mark.X = Product.Inst.Stickdata.TrayData.ProductList[MarkscanProduct].MarkPoint[whichMark].X + TaskMain.UpCamLogc.Result[0].X; mark.Y = Product.Inst.Stickdata.TrayData.ProductList[MarkscanProduct].MarkPoint[whichMark].Y + TaskMain.UpCamLogc.Result[0].Y; mark.R = Product.Inst.Stickdata.TrayData.ProductList[MarkscanProduct].MarkPoint[whichMark].R + TaskMain.UpCamLogc.Result[0].R; } VisionProject.Instance.Tool.PointLocation.SetBenchmark2 ( whichMark, mark.X, mark.Y ); MarkResult.Add(mark); whichMark++; if (whichMark >= 2) { VisionProject.Instance.Tool.PointLocation.Calculation(); if (Product.Inst.IsAging) { Para.ProcessData.StickPosList.Add(stickPos); } else { //计算Mark点,并暂存计算结果 Para.ProcessData.StickPosList.Add(MarkCaculate(stickPos)); //计算Mark点,并保存计算结果 } LG.StepNext(8); } else { LG.StepNext(4); } break; case 8: DeviceRsDef.Q_UpLighSource.OFF(); if (MarkscanProduct >= Product.Inst.Stickdata.TrayData.ProductList.Count - 1) { LG.StepNext(0xef); } else { LG.StepNext(3); whichMark = 0; MarkscanProduct++; } break; case 0xef: LG.End(); break; } }
protected override void LogicImpl() { var Para = Product.Inst; LG.Start(); switch (LG.Step) { case 1: //Z轴抬起到安全高度 if (CTRCard.ZArrive) { for (int i = 0; i < 2; i++) { CTRCard.Axis_Z[i].MC_MoveAbs(Para.Stickdata.GiveUpPara.SafePos_Z); } LG.StepNext(2); } whichNuzzle = 0; break; case 2: //判断轴到达 if (CTRCard.ZArrive) { LG.StepNext(3); } break; case 3: if (Para.ProcessData.NuzzlePara[whichNuzzle].isOk != 1 && Para.ProcessData.NuzzlePara[whichNuzzle].isHave == true) { LG.StepNext(4); } else { LG.StepNext(8); } break; case 4: //XY到弃标位 if (CTRCard.ZArrive) { if (whichNuzzle == 0) { CTRCard.Axis_X.MC_MoveAbs(Para.Stickdata.GiveUpPara.LiftGiveUpPos.X); CTRCard.Axis_Y.MC_MoveAbs(Para.Stickdata.GiveUpPara.LiftGiveUpPos.Y); LG.StepNext(5); } else { CTRCard.Axis_X.MC_MoveAbs(Para.Stickdata.GiveUpPara.RightGiveUpPos.X); CTRCard.Axis_Y.MC_MoveAbs(Para.Stickdata.GiveUpPara.RightGiveUpPos.Y); LG.StepNext(5); } } break; case 5: //Z到弃标高度 if (CTRCard.XYArrive) { if (whichNuzzle == 0) { CTRCard.Axis_Z[whichNuzzle].MC_MoveAbs(Para.Stickdata.GiveUpPara.LiftGiveUp_Z); LG.StepNext(6); } else { CTRCard.Axis_Z[whichNuzzle].MC_MoveAbs(Para.Stickdata.GiveUpPara.RightGiveUp_Z); LG.StepNext(6); } } break; case 6: //破真空,吹气 if (CTRCard.ZArrive) { CTRCard.Q_Nuzzle[whichNuzzle].OFF(); CTRCard.Q_Blow[whichNuzzle].ON(); Para.Stickdata.GiveUpPara.giveUpNum++; LG.StepNext(7); } break; case 7: if (LG.Delay(Para.Stickdata.GiveUpPara.GiveUpDelay)) /*弃料延时*/ { LG.StepNext(8); Para.ProcessData.NuzzlePara[whichNuzzle].isHave = false; CTRCard.Q_Blow[whichNuzzle].Value = false; CTRCard.Axis_Z[whichNuzzle].MC_MoveAbs(Para.Stickdata.GiveUpPara.SafePos_Z); } break; case 8: //Z轴回到安全位 if (CTRCard.ZArrive) { whichNuzzle++; if (whichNuzzle < CTRCard.Axis_Z.Count) { LG.StepNext(2); } else { LG.StepNext(0xef); } } break; case 0xef: LG.End(); break; } }
protected override void LogicImpl() { var Para = Product.Inst.Stickdata; switch (LG.Step) { case 1: whichproduct = Product.Inst.Stickdata.TrayData.ProductList.Count - 1; DataList.Clear(); LG.StepNext(2); break; case 2: for (int i = 0; i < CTRCard.Axis_Z.Count; i++) { CTRCard.Axis_Z[i].MC_MoveAbs(Para.ZSafePos); } LG.StepNext(3); break; case 3: if (CTRCard.ZArrive) { if (Product.Inst.Stickdata.TrayData.ProductList.Count > 0) { LG.StepNext(4); } else { LG.StepNext(0xef); } } break; case 4: if (Para.CanscanCode) { CTRCard.Axis_X.MC_MoveAbs(Product.Inst.Stickdata.TrayData.ProductList[whichproduct].CodePoint2.X); CTRCard.Axis_Y.MC_MoveAbs(Product.Inst.Stickdata.TrayData.ProductList[whichproduct].CodePoint2.Y); LG.StepNext(5); } else { LG.StepNext(0xef); } break; case 5: if (CTRCard.XYArrive) { LG.StepNext(6); } break; case 6: if (CTRCard.XYArrive) { LG.StepNext(7); DeviceRsDef.Q_Light.ON(); DeviceRsDef.Q_HoldLightCtrl.OFF(); } break; case 7: if (LG.Delay(10)) { //VisionProject.Instance.visionApi.TrigRun(2, 0); LG.StepNext(8); } break; case 8: if (Product.Inst.IsAging) { //老化模式下,不判断拍照结果 if (LG.TCnt(500)) { LG.StepNext(10); } } else { //正常模式下 //if (VisionProject.Instance.visionApi.Trig == false) //{ // if (VisionProject.Instance.visionApi.Error == 0) // { // LG.StepNext(9); // } // else // { // LG.StepNext(10); // } //} } break; case 9: //DataList.Add(VisionProject.Instance.visionApi.CodeString);//将读取到的二维码信息加进list里面 //ShowMessge.SendStartMsg(string.Format("产品{0}二维码:{1}", whichproduct, VisionProject.Instance.visionApi.CodeString)); LG.StepNext(10); break; case 10: whichproduct--; if (whichproduct <= -1) { LG.StepNext(0xef); } else { LG.StepNext(3); } break; case 0xef: DeviceRsDef.Q_HoldLightCtrl.ON(); DeviceRsDef.Q_Light.OFF(); LG.End(); break; } }
protected override void LogicImpl() { var Para = Product.Inst; switch (LG.Step) { case 1: if (TaskMain.sticklogic.feeder.GetBusy) { return; } TakeCount = 0; //取料个数 whichNuzzle = 0; //哪个吸嘴 LG.StepNext(2); break; case 2: //Z轴抬起到安全高度 for (int i = 0; i < CTRCard.Axis_Z.Count; i++) { CTRCard.Axis_Z[i].MC_MoveAbs(Para.Stickdata.ZSafePos); //Z到安全位置 CTRCard.Axis_R[i].MC_MoveAbs(0); } LG.StepNext(3); break; case 3: if (CTRCard.ZArrive && CTRCard.RArrive) { bool isCanTake = false; if ( Para.Stickdata.NuzzleForbit[whichNuzzle] == false && Para.ProcessData.NuzzlePara[whichNuzzle].isHave == false) //吸嘴没被禁用且没有料 { isCanTake = true; } else { if (Para.Stickdata.NuzzleForbit[whichNuzzle] == true) //吸嘴禁用取料加1 { TakeCount++; } } if (isCanTake) { if (TakeCount == 1 && whichNuzzle == 1) { LG.StepNext(7); //如果左吸嘴取过一次且目前可以取料的是右吸嘴 } else { LG.StepNext(4); //可以取料 去取料位置 } } else { LG.StepNext(14); //去 判断 } } break; case 4: if (whichNuzzle == 0) { Ltime.Stop(); Lsticktime = (int)Ltime.ElapsedMilliseconds; Ltime.Restart(); } else { Rtime.Stop(); Rsticktime = (int)Rtime.ElapsedMilliseconds; Rtime.Restart(); } CTRCard.Axis_X.MC_MoveAbs(Para.Stickdata.FeederPara.TakePos.X); CTRCard.Axis_Y.MC_MoveAbs(Para.Stickdata.FeederPara.TakePos.Y); //到拍照位置 DeviceRsDef.Q_UpLighSource.ON(); //上光源打开 LG.StepNext(5); break; case 5: if (CTRCard.XYArrive) { //VisionProject.Instance.visionApi.TrigRun(0, 2);//触发拍照 LG.StepNext(6); } break; case 6: if (Product.Inst.IsAging) { if (LG.Delay(200)) { CCDresult.X = 0; CCDresult.Y = 0; CCDresult.R = 0; LG.StepNext(7); } } else { //if (VisionProject.Instance.visionApi.Trig == false)//相机触发的值 //{ // if (VisionProject.Instance.visionApi.Error == 0)//相机接口错误码 // { // LG.StepNext(7);//xy到取标位置 // DeviceRsDef.Q_UpLighSource.OFF();//上相机光源关闭 // } // else // { // LG.StepNext(101);//重新送料 // CTCount++;//拍照识别次数 // if (CTCount > 2)//大于2就视觉NG // { // CTCount = 0;//重新置零 // Alarm.SetAlarm(AlarmLevelEnum.Level2, "Feeder视觉NG");//报警 // } // } //} } break; case 7: CTRCard.Q_Blow[whichNuzzle].OFF(); //吹气关闭 if (Product.Inst.IsAging) { if (LG.Delay(500)) { CCDresult.X = 0; CCDresult.Y = 0; CCDresult.R = 0; } } //else if (VisionProject.Instance.visionApi.Result.Length == 2) //{ // CCDresult.X = (float)VisionProject.Instance.visionApi.Result[TakeCount].X;//ccd的x值[改为链表形式] // CCDresult.Y = (float)VisionProject.Instance.visionApi.Result[TakeCount].Y;//ccd的y值 // CCDresult.R = -(float)VisionProject.Instance.visionApi.Result[TakeCount].R;//ccd的r值 //} //else //{ // CCDresult.X = (float)VisionProject.Instance.visionApi.Result[0].X;//ccd的x值[改为链表形式] // CCDresult.Y = (float)VisionProject.Instance.visionApi.Result[0].Y;//ccd的y值 // CCDresult.R = -(float)VisionProject.Instance.visionApi.Result[0].R;//ccd的r值 //} CTRCard.Axis_X.MC_MoveAbs(TakePos(whichNuzzle).X + (float)CCDresult.X); CTRCard.Axis_Y.MC_MoveAbs(TakePos(whichNuzzle).Y + (float)CCDresult.Y); CTRCard.Axis_R[whichNuzzle].MC_MoveAbs((float)CCDresult.R); LG.StepNext(8); break; case 8: //XY到位后判断缓取,开始下压时打开吸嘴 if (CTRCard.RArrive && CTRCard.XYArrive) { if (whichNuzzle == 0) { CTRCard.Axis_Z[whichNuzzle].MC_MoveAbs(Para.Stickdata.TakeLabelPara.LiftTakePos_Z); } else { CTRCard.Axis_Z[whichNuzzle].MC_MoveAbs(Para.Stickdata.TakeLabelPara.RightTakePos_Z); } LG.StepNext(9); } break; case 9: if (CTRCard.ZArrive) { CTRCard.Q_Nuzzle[whichNuzzle].ON(); //真空打开 CTRCard.Q_Blow[whichNuzzle].OFF(); //吹气关闭 LG.StepNext(10); } break; case 10: if (whichNuzzle == 0) { Para.Stickdata.TakeLabelPara.TakeLableWholeLNum++; } else { Para.Stickdata.TakeLabelPara.TakeLableWholeRNum++; } LG.StepNext(11); break; case 11: //取标延时后Z轴抬起(缓抬) if (whichNuzzle == 0 && LG.Delay(Para.Stickdata.TakeLabelPara.LiftTakeDelay)) { LG.StepNext(201); } else if (whichNuzzle == 1 && LG.Delay(Para.Stickdata.TakeLabelPara.RightTakeDelay)) { LG.StepNext(201); } break; case 201: if (Para.Stickdata.FeederPara.FeederMode[1]) { //剥标板回退 LG.StepNext(202); } else { LG.StepNext(12); } break; case 202: if (Para.Stickdata.FeederPara.FeederMode[1]) //拨标板回退停止 { CTRCard.Axis_Z[whichNuzzle].MC_MoveAbs(Para.Stickdata.ZSafePos); //Z轴抬起 LG.StepNext(13); } break; case 12: //取标延时后Z轴抬起 if (CTRCard.ZArrive) { CTRCard.Axis_Z[whichNuzzle].MC_MoveAbs(Para.Stickdata.ZSafePos); LG.StepNext(13); } break; case 13: //检测真空//add if (CTRCard.ZArrive) //所有轴都到达 { if (!Product.Inst.IsAging && CTRCard.I_Vacuum[whichNuzzle].Value == false) { TakeNum++; if (TakeNum >= 2) { TakeNum = 0; LG.StepNext(101); //运行状态下进入14 重新剥标 CTRCard.Q_Nuzzle[whichNuzzle].Value = false; //吸真空电磁阀 Alarm.SetAlarm(AlarmLevelEnum.Level2, "取料失败,请检查真空和真空感应"); Para.ProcessData.NuzzlePara[whichNuzzle].isHave = false; //是否有料 } else { LG.StepNext(4); //到拍照位 } } else { if (whichNuzzle == 0) { Para.Stickdata.TakeLabelPara.TakeLableLNum++; } else { Para.Stickdata.TakeLabelPara.TakeLableRNum++; } LG.StepNext(14); //结束 Para.ProcessData.NuzzlePara[whichNuzzle].isHave = true; //有料 } } break; case 101: if (CTRCard.ZArrive) { LG.StepNext(4); } break; case 14: //结束 if (CTRCard.ZArrive) { whichNuzzle++; //吸嘴换成另一个吸嘴 TakeCount++; if (whichNuzzle >= 2) { LG.StepNext(15); } else { LG.StepNext(2); } } break; case 15: if (TakeCount >= 2) { LG.StepNext(0xef); } //else if (VisionProject.Instance.visionApi.Result.Length == 1) //{ // TakeCount = 0; // LG.StepNext(0xef); //} else if (Para.ProcessData.NuzzlePara[0].isHave == true && Para.ProcessData.NuzzlePara[1].isHave == true) { TakeCount = 0; LG.StepNext(0xef); } else { LG.StepNext(2); } break; case 0xef: LG.End(); break; } }