Exemplo n.º 1
0
        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;
            }
        }
Exemplo n.º 2
0
        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;
            }
        }
Exemplo n.º 3
0
        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;
            }
        }
Exemplo n.º 4
0
        protected override void LogicImpl()
        {
            switch (LG.Step)
            {
            case 1:
                if (ID <= 1)
                {
                    Axis.PolishZ[ID].MC_MoveAbs(ProjectData.Instance.SaveData.PolishData[ID].SafeZ);
                    LG.ImmediateStepNext(2);
                }
                else if (ID > 1)
                {
                    Axis.SolderZ[ID - 2].MC_MoveAbs(ProjectData.Instance.SaveData.SolderData[ID - 2].SafeZ);
                    LG.ImmediateStepNext(2);
                }
                break;

            case 2:
                if (ID <= 1 && Axis.PolishX[ID].status == 0 && Axis.PolishY[ID].status == 0 && Axis.PolishZ[ID].status == 0)
                {
                    Axis.PolishX[ID].MC_MoveAbs(ProjectData.Instance.SaveData.processdata.LocatedPointPos.X);
                    Axis.PolishY[ID].MC_MoveAbs(ProjectData.Instance.SaveData.processdata.LocatedPointPos.Y);
                    LG.ImmediateStepNext(3);
                }
                else if (ID > 1 && Axis.SolderX[ID - 2].status == 0 && Axis.SolderY[ID - 2].status == 0 && Axis.SolderZ[ID - 2].status == 0)
                {
                    Axis.SolderX[ID - 2].MC_MoveAbs(ProjectData.Instance.SaveData.processdata.LocatedPointPos.X);
                    Axis.SolderY[ID - 2].MC_MoveAbs(ProjectData.Instance.SaveData.processdata.LocatedPointPos.Y);
                    LG.ImmediateStepNext(3);
                }
                break;

            case 3:
                if (ID <= 1 && Axis.PolishX[ID].status == 0 && Axis.PolishY[ID].status == 0)
                {
                    Axis.PolishR[ID].MC_MoveAbs(ProjectData.Instance.SaveData.processdata.LocatedPointPos.R);
                    Axis.PolishZ[ID].MC_MoveAbs(ProjectData.Instance.SaveData.processdata.LocatedPointPos.Z);
                    LG.ImmediateStepNext(4);
                }
                else if (ID > 1 && Axis.SolderX[ID - 2].status == 0 && Axis.SolderY[ID - 2].status == 0)
                {
                    Axis.SolderR[ID - 2].MC_MoveAbs(ProjectData.Instance.SaveData.processdata.LocatedPointPos.R);
                    Axis.SolderZ[ID - 2].MC_MoveAbs(ProjectData.Instance.SaveData.processdata.LocatedPointPos.Z);
                    LG.ImmediateStepNext(4);
                }
                break;

            case 4:
                if (ID <= 1 && Axis.PolishR[ID].status == 0 && Axis.PolishZ[ID].status == 0)
                {
                    LG.End();
                }
                else if (ID > 1 && Axis.SolderR[ID - 2].status == 0 && Axis.SolderZ[ID - 2].status == 0)
                {
                    LG.End();
                }
                break;
            }
        }
Exemplo n.º 5
0
        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;
            }
        }
Exemplo n.º 6
0
        protected override void LogicImpl()
        {
            switch (LG.Step)
            {
            case 1:
                LG.ImmediateStepNext(2);
                break;

            case 2:
                LG.End();
                break;
            }
        }
Exemplo n.º 7
0
        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;
            }
        }
Exemplo n.º 8
0
        protected override void LogicImpl()
        {
            switch (LG.Step)
            {
            case 1:
                TaskManager.Default.FindTask("皮带流程").Start();
                LG.ImmediateStepNext(2);
                break;

            case 2:
                if (TaskManager.Default.FindTask("皮带流程").Status)
                {
                    TaskManager.Default.FindTask("左打磨平台").Start();
                    TaskManager.Default.FindTask("右打磨平台").Start();
                    TaskManager.Default.FindTask("右焊锡平台").Start();
                    TaskManager.Default.FindTask("左焊锡平台").Start();
                    LG.ImmediateStepNext(3);
                }
                break;

            case 3:
                if (
                    TaskManager.Default.FindTask("左打磨平台").Status &&
                    TaskManager.Default.FindTask("右打磨平台").Status &&
                    TaskManager.Default.FindTask("右焊锡平台").Status &&
                    TaskManager.Default.FindTask("左焊锡平台").Status
                    )
                {
                    LG.ImmediateStepNext(0xef);
                }
                break;

            case 0xef:
                if (TaskManager.Default.FSM.MODE == 1 && LG.Delay(2000))
                {
                    LG.ImmediateStepNext(1);
                }
                else
                {
                    LG.End();
                    TaskManager.Default.FSM.Change(FSMStaDef.STOP);
                }
                break;
            }
        }
Exemplo n.º 9
0
        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;
            }
        }
Exemplo n.º 10
0
        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;
            }
        }
Exemplo n.º 11
0
        protected override void LogicImpl()
        {
            switch (LG.Step)
            {
            case 1:
                DeviceRsDef.Ax_刮锡膏.MC_MoveAbs(StartPos);
                LG.ImmediateStepNext(2);
                DeviceRsDef.Q_刮刀1.OFF();
                DeviceRsDef.Q_刮刀2.OFF();
                break;

            case 2:
                if (DeviceRsDef.Ax_刮锡膏.status == AxState.AXSTA_READY)
                {
                    DeviceRsDef.Q_刮刀1.ON();
                    DeviceRsDef.Q_刮刀2.ON();
                    LG.ImmediateStepNext(3);
                }
                break;

            case 3:
                if (LG.TCnt(Delay))
                {
                    DeviceRsDef.Ax_刮锡膏.MC_MoveAbs(EndPos);
                    LG.ImmediateStepNext(4);
                }
                break;

            case 4:
                if (DeviceRsDef.Ax_刮锡膏.status == AxState.AXSTA_READY)
                {
                    DeviceRsDef.Q_刮刀1.OFF();
                    DeviceRsDef.Q_刮刀2.OFF();
                    LG.ImmediateStepNext(5);
                }
                break;

            case 5:
                LG.End();
                break;
            }
        }
Exemplo n.º 12
0
        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;
            }
        }
Exemplo n.º 13
0
        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;
            }
        }
Exemplo n.º 14
0
        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;
            }
        }
Exemplo n.º 15
0
        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;
            }
        }
Exemplo n.º 16
0
        protected override void LogicImpl()
        {
            switch (LG.Step)
            {
            case 1:    //z抬高到翻转位置
                if (DeviceRsDef.Axis_Z5.status == 0)
                {
                    DeviceRsDef.Axis_Z5.MC_MoveAbs(ProjectData.Instance.SaveData.ReverseData.ReversZ);
                    LG.ImmediateStepNext(2);
                }
                break;

            case 2:    //XR到达工作的位置
                if (DeviceRsDef.Axis_Z5.status == 0)
                {
                    DeviceRsDef.Axis_X5.MC_MoveAbs(ProjectData.Instance.SaveData.ReverseData.WorkPos.X);
                    DeviceRsDef.Axis_R5.MC_MoveAbs(ProjectData.Instance.SaveData.ReverseData.WorkPos.R);
                    LG.ImmediateStepNext(3);
                }
                break;

            case 3:    //Z到达工作的位置
                if (DeviceRsDef.Axis_X5.status == 0 && DeviceRsDef.Axis_R5.status == 0)
                {
                    DeviceRsDef.Axis_Z5.MC_MoveAbs(ProjectData.Instance.SaveData.ReverseData.WorkPos.Z);
                    LG.ImmediateStepNext(4);
                }
                break;

            case 4:    //夹紧气缸打开
                if (DeviceRsDef.Axis_Z5.status == 0)
                {
                    DeviceRsDef.Q_BeforeTurnCyl.Value = true;
                    LG.ImmediateStepNext(5);
                }
                break;

            case 5:    //Z轴到翻转位置
                if (LG.Delay(50) && DeviceRsDef.I_BeforeTurnCylClosed.value)
                {
                    DeviceRsDef.Axis_Z5.MC_MoveAbs(ProjectData.Instance.SaveData.ReverseData.ReversZ);
                    LG.ImmediateStepNext(6);
                }
                break;

            case 6:    //R轴旋转
                if (DeviceRsDef.I_BeforeTurnCylClosed.value && DeviceRsDef.Axis_Z5.status == 0)
                {
                    DeviceRsDef.Axis_R5.MC_MoveSpd(1);
                    LG.ImmediateStepNext(7);
                }
                break;

            case 7:    //转到180度停止R
                if (DeviceRsDef.I_BeforeTurnCylClosed.value && DeviceRsDef.I_TurnCyl180.value)
                {
                    DeviceRsDef.Axis_R5.MC_Stop();
                    LG.ImmediateStepNext(8);
                }
                break;

            case 8:    //Z轴下降到工作位置
                if (DeviceRsDef.I_BeforeTurnCylClosed.value && DeviceRsDef.I_TurnCyl180.value && DeviceRsDef.Axis_R5.status == 0)
                {
                    DeviceRsDef.Axis_Z5.MC_MoveAbs(ProjectData.Instance.SaveData.ReverseData.WorkPos.Z);
                    LG.ImmediateStepNext(9);
                }
                break;

            case 9:    //夹紧气缸打开
                if (DeviceRsDef.I_BeforeTurnCylClosed.value && DeviceRsDef.I_TurnCyl180.value && DeviceRsDef.Axis_Z5.status == 0)
                {
                    DeviceRsDef.Q_BeforeTurnCyl.Value = false;
                    LG.ImmediateStepNext(11);
                }
                break;

            case 11:    //Z轴回到翻转位
                if (LG.Delay(50))
                {
                    DeviceRsDef.Axis_Z5.MC_MoveAbs(ProjectData.Instance.SaveData.ReverseData.ReversZ);
                    LG.ImmediateStepNext(12);
                }
                break;

            case 12:    //R轴回零度
                if (LG.Delay(50) && DeviceRsDef.Axis_Z5.status == 0)
                {
                    DeviceRsDef.Axis_R5.MC_MoveSpd(-1);
                    LG.ImmediateStepNext(13);
                }
                break;

            case 13:    //回零到位
                if (DeviceRsDef.I_TurnCyl.value)
                {
                    DeviceRsDef.Axis_R5.MC_Stop();
                    LG.ImmediateStepNext(14);
                }
                break;

            case 14:    //XZ到结束位置
                if (DeviceRsDef.Axis_R5.status == 0)
                {
                    DeviceRsDef.Axis_Z5.MC_MoveAbs(ProjectData.Instance.SaveData.ReverseData.EndPos.Z);
                    DeviceRsDef.Axis_X5.MC_MoveAbs(ProjectData.Instance.SaveData.ReverseData.EndPos.X);
                    LG.ImmediateStepNext(15);
                }
                break;

            case 15:    //结束
                if (DeviceRsDef.Axis_X5.status == 0 && DeviceRsDef.Axis_Z5.status == 0)
                {
                    LG.ImmediateStepNext(0xef);
                    ProjectData.Instance.SaveData.processdata.PlatformData[4].Isreversed = true;
                }
                break;

            case 0xef:
                LG.End();
                break;
            }
        }
Exemplo n.º 17
0
        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;
            }
        }
Exemplo n.º 18
0
        protected override void LogicImpl()
        {
            switch (LG.Step)
            {
            case 1:
                for (int i = 0; i < 60; i++)
                {
                    //板卡输出去使能
                    DeviceRsDef.MotionCard.MotionFun.OutputOFF(i);
                    DeviceRsDef.MotionCard1.MotionFun.OutputOFF(i);
                }
                for (int i = 0; i < DeviceRsDef.AxisList.Count; i++)    //轴停止
                {
                    DeviceRsDef.AxisList[i].MC_Stop();
                }
                LogicMission.BeltFeedFun.FromReset = true;
                MachineAlarm.ClearAlarm();    //清除报警
                LG.ImmediateStepNext(10);
                break;

            case 10:
                if (LG.Delay(2000))
                {
                    //ZR轴回零
                    DeviceRsDef.Axis_Z1.MC_Home();
                    DeviceRsDef.Axis_Z2.MC_Home();
                    DeviceRsDef.Axis_Z3.MC_Home();
                    DeviceRsDef.Axis_Z4.MC_Home();
                    //DeviceRsDef.Axis_Z5.MC_Home();

                    DeviceRsDef.Axis_R1.MC_Home();
                    DeviceRsDef.Axis_R2.MC_Home();
                    DeviceRsDef.Axis_R3.MC_Home();
                    DeviceRsDef.Axis_R4.MC_Home();
                    LG.ImmediateStepNext(2);
                }
                break;

            case 2:
                if (Axis.allaixsarrive())
                {
                    DeviceRsDef.Axis_X1.MC_Home();
                    DeviceRsDef.Axis_X2.MC_Home();
                    DeviceRsDef.Axis_X3.MC_Home();
                    DeviceRsDef.Axis_X4.MC_Home();
                    //DeviceRsDef.Axis_X5.MC_Home();

                    DeviceRsDef.Axis_Y1.MC_Home();
                    DeviceRsDef.Axis_Y2.MC_Home();
                    DeviceRsDef.Axis_Y3.MC_Home();
                    DeviceRsDef.Axis_Y4.MC_Home();


                    //DeviceRsDef.Axis_R5.MC_Home();
                    //DeviceRsDef.Axis_X5.MC_Home();
                    DeviceRsDef.Axis_Belt.MC_Home();
                    LG.ImmediateStepNext(3);
                }
                break;

            case 3:
                if (Axis.allaixsarrive())
                {
                    for (int i = 0; i < 2; i++)
                    {
                        Axis.PolishX[i].MC_MoveAbs(ProjectData.Instance.SaveData.PolishPlatform[i].ResetPos.X);
                        Axis.PolishY[i].MC_MoveAbs(ProjectData.Instance.SaveData.PolishPlatform[i].ResetPos.Y);
                        Axis.PolishZ[i].MC_MoveAbs(ProjectData.Instance.SaveData.PolishPlatform[i].ResetPos.Z);
                        Axis.PolishR[i].MC_MoveAbs(ProjectData.Instance.SaveData.PolishPlatform[i].ResetPos.R);
                    }
                    for (int i = 0; i < 2; i++)
                    {
                        Axis.SolderX[i].MC_MoveAbs(ProjectData.Instance.SaveData.SolderPlatform[i].ResetPos.X);
                        Axis.SolderY[i].MC_MoveAbs(ProjectData.Instance.SaveData.SolderPlatform[i].ResetPos.Y);
                        Axis.SolderZ[i].MC_MoveAbs(ProjectData.Instance.SaveData.SolderPlatform[i].ResetPos.Z);
                        Axis.SolderR[i].MC_MoveAbs(ProjectData.Instance.SaveData.SolderPlatform[i].ResetPos.R);
                    }

                    LG.ImmediateStepNext(0xef);
                }
                break;

            case 0xef:
                if (Axis.allaixsarrive())
                {
                    LG.End();
                    TaskManager.Default.FSM.Change(FSMStaDef.STOP);
                }
                break;
            }
        }
Exemplo n.º 19
0
        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;
            }
        }
Exemplo n.º 20
0
        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;
            }
        }
Exemplo n.º 21
0
        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;
            }
        }
Exemplo n.º 22
0
        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;
            }
        }
Exemplo n.º 23
0
        protected override void LogicImpl()
        {
            var para = ProjectData.Instance.SaveData.SolderCleanData[ID];

            switch (LG.Step)
            {
            case 1:    //RZ抬起
                if (Axis.SolderR[ID].status == 0 && Axis.SolderZ[ID].status == 0)
                {
                    Axis.SolderR[ID].MC_MoveAbs(0);
                    Axis.SolderZ[ID].MC_MoveAbs(0);
                    LG.ImmediateStepNext(2);
                }
                break;

            case 2:    //XY到清洗位
                if (Axis.SolderR[ID].status == 0 && Axis.SolderZ[ID].status == 0)
                {
                    Axis.SolderX[ID].MC_MoveAbs(para.CleanPos.X);
                    Axis.SolderY[ID].MC_MoveAbs(para.CleanPos.Y);
                    LG.ImmediateStepNext(3);
                }
                break;

            case 3:    //RZ到清洗位
                if (Axis.SolderX[ID].status == 0 && Axis.SolderY[ID].status == 0)
                {
                    Axis.SolderR[ID].MC_MoveAbs(para.CleanPos.R);
                    Axis.SolderZ[ID].MC_MoveAbs(para.CleanPos.Z);
                    LG.ImmediateStepNext(4);
                }
                break;

            case 4:    //打开吹气电磁阀
                if (Axis.SolderR[ID].status == 0 && Axis.SolderZ[ID].status == 0)
                {
                    Axis.Soldervalve[ID].ON();
                    LG.ImmediateStepNext(5);
                }
                break;

            case 5:    //吹气清洗时间
                if (LG.Delay(para.CleanTime))
                {
                    Axis.Soldervalve[ID].OFF();
                    LG.ImmediateStepNext(6);
                }
                break;

            case 6:
                Axis.SolderR[ID].MC_MoveAbs(0);
                Axis.SolderZ[ID].MC_MoveAbs(0);
                LG.ImmediateStepNext(7);
                break;

            case 7:
                if (Axis.SolderR[ID].status == 0 && Axis.SolderZ[ID].status == 0)
                {
                    LG.ImmediateStepNext(0xef);
                }
                break;

            case 0xef:
                LG.End();
                break;
            }
        }
Exemplo n.º 24
0
        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;
            }
        }
Exemplo n.º 25
0
        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;
            }
        }
Exemplo n.º 26
0
        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;
            }
        }
Exemplo n.º 27
0
        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;
            }
        }
Exemplo n.º 28
0
        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;
            }
        }
Exemplo n.º 29
0
        protected override void LogicImpl()
        {
            switch (LG.Step)
            {
            case 1:
                if (DeviceRsDef.Axis_Belt.currPos == 0 && FromReset)
                {
                    DeviceRsDef.Q_BeltLocatedCyl.ON();
                    if (TaskManager.Default.FSM.MODE == 1 && DeviceRsDef.I_CylLocked.Value)
                    {
                        LG.ImmediateStepNext(7);
                        FromReset = false;
                    }
                    else if (DeviceRsDef.I_CylLocked.Value)
                    {
                        LG.ImmediateStepNext(0xef);
                        FromReset = false;
                    }
                }
                else
                {
                    DeviceRsDef.Q_BeltLocatedCyl.OFF();    //打开环形导轨的定位气缸
                    LG.ImmediateStepNext(10);
                }
                break;

            case 10:
                if (LG.Delay(100) && DeviceRsDef.I_CylUnLocked.Value)
                {
                    if (DeviceRsDef.I_material1.value)    //环形定位气缸打开状态且有零件
                    {
                        LG.ImmediateStepNext(2);
                    }
                    else if (TaskManager.Default.FSM.MODE == 1 && DeviceRsDef.I_CylUnLocked.Value)
                    {
                        LG.ImmediateStepNext(2);
                    }
                    else
                    {
                        MachineAlarm.SetAlarm(AlarmLevelEnum.Level2, "零件未放入,零件感应1未感应到物料");
                        LG.StepNextWithOut(2, FSMStaDef.ALARM);
                    }
                }
                break;

            case 2:
                if (
                    LG.Delay(500) &&          //气缸延时200ms
                    TaskManager.Default.FindTask("左打磨平台").Status &&
                    TaskManager.Default.FindTask("右打磨平台").Status &&
                    TaskManager.Default.FindTask("左焊锡平台").Status &&
                    TaskManager.Default.FindTask("右焊锡平台").Status
                    )
                {
                    DeviceRsDef.Axis_Belt.MC_MoveRel(230);    //传送带向前走230mm
                    LG.ImmediateStepNext(4);
                }
                break;

            case 4:
                if (LG.Delay(100) && DeviceRsDef.Axis_Belt.status == 0) //延时100
                {
                    DeviceRsDef.Axis_Belt.MC_Stop();                    //传送带停止
                    LG.ImmediateStepNext(5);
                }
                break;

            case 5:
                if (DeviceRsDef.Axis_Belt.status == Device.AxState.AXSTA_READY) //皮带轴停止
                {
                    DeviceRsDef.Q_BeltLocatedCyl.ON();                          //打开皮带的定位气缸
                    LG.ImmediateStepNext(6);
                }
                break;

            case 6:
                if (LG.Delay(150) && DeviceRsDef.I_CylLocked.value) //环形定位气缸已经锁定,延时150ms
                {
                    if (TaskManager.Default.FSM.MODE == 1)          //老化模式
                    {
                        LG.ImmediateStepNext(7);
                    }
                    else
                    {
                        LG.ImmediateStepNext(0xef);
                    }
                }
                break;

            case 7:
                if (LG.Delay(50))
                {
                    LG.End();    //老化模式下不进行平台的数据传递
                }
                break;

            case 0xef:
                if (LG.Delay(50))
                {
                    LG.End();
                    ProjectData.Instance.SaveData.processdata.PlatformData[0].IsTined = true;                    //第一个工位有料
                    for (int i = ProjectData.Instance.SaveData.processdata.PlatformData.Count() - 1; i > 0; i--) //工位信息传递
                    {
                        ProjectData.Instance.SaveData.processdata.PlatformData[i].SetLastPlatformData(ProjectData.Instance.SaveData.processdata.PlatformData[i - 1]);
                    }
                }
                break;
            }
        }
Exemplo n.º 30
0
        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;
            }
        }