Пример #1
0
 public override void ZoneInit()
 {
     base.ZoneInit();
     AssignHardware(typeof(EnumAxisName), typeof(EnumInportName), typeof(EnumOutportName));
     AxisSortingPNPY    = ThisAxis(EnumAxisName.SortingPNPY);
     AxisSortingPNPZ    = ThisAxis(EnumAxisName.SortingPNPZ);
     NGBoxFullSensor[0] = ThisInport(EnumInportName.SortingPNPNGBoxFull1);
     NGBoxFullSensor[1] = ThisInport(EnumInportName.SortingPNPNGBoxFull2);
     NGBoxFullSensor[2] = ThisInport(EnumInportName.SortingPNPNGBoxFull3);
     NGBoxFullSensor[3] = ThisInport(EnumInportName.SortingPNPNGBoxFull4);
     NGBoxBackSenser    = ThisInport(EnumInportName.SortingPNPNGBoxBack);
     NGBoxFrontSensor   = ThisInport(EnumInportName.SortingPNPNGBoxFront);
     AxisSortingPNPY.AddPoints(typeof(EnumPointPNPY));
     AxisSortingPNPZ.AddPoints(typeof(EnumPointPNPZ));
     PNPCylinder.Add(EnumCellIndex.左电芯, new CylinderControl(/*"左电芯Z气缸", "下降", "上升",*/
                         ThisOutport(EnumOutportName.SortingPNPCyLeftDown),
                         ThisOutport(EnumOutportName.SortingPNPCyLeftUp),
                         ThisInport(EnumInportName.SortingPNPCyLeftDown),
                         ThisInport(EnumInportName.SortingPNPCyLeftUp)));
     PNPCylinder.Add(EnumCellIndex.中电芯, new CylinderControl(/*"中电芯Z气缸", "下降", "上升",*/
                         ThisOutport(EnumOutportName.SortingPNPCyMidDown),
                         ThisOutport(EnumOutportName.SortingPNPCyMidUp),
                         ThisInport(EnumInportName.SortingPNPCyMidDown),
                         ThisInport(EnumInportName.SortingPNPCyMidUp)));
     PNPCylinder.Add(EnumCellIndex.右电芯, new CylinderControl(/*"右电芯Z气缸", "下降", "上升",*/
                         ThisOutport(EnumOutportName.SortingPNPCyRightDown),
                         ThisOutport(EnumOutportName.SortingPNPCyRightUp),
                         ThisInport(EnumInportName.SortingPNPCyRightDown),
                         ThisInport(EnumInportName.SortingPNPCyRightUp)));
     CellVacuums[EnumCellIndex.左电芯].MainPort.Port =
         ThisOutport(EnumOutportName.SortingPNPVacLeft);
     CellVacuums[EnumCellIndex.左电芯].AirPorts[(int)EnumVacuumIndex.后真空].Port =
         ThisOutport(EnumOutportName.SortingPNPVacLeftBack);
     CellVacuums[EnumCellIndex.左电芯].AirPorts[(int)EnumVacuumIndex.中真空].Port =
         ThisOutport(EnumOutportName.SortingPNPVacLeftCent);
     CellVacuums[EnumCellIndex.左电芯].AirPorts[(int)EnumVacuumIndex.前真空].Port =
         ThisOutport(EnumOutportName.SortingPNPVacLeftFront);
     CellVacuums[EnumCellIndex.中电芯].MainPort.Port =
         ThisOutport(EnumOutportName.SortingPNPVacMid);
     CellVacuums[EnumCellIndex.中电芯].AirPorts[(int)EnumVacuumIndex.后真空].Port =
         ThisOutport(EnumOutportName.SortingPNPVacMidBack);
     CellVacuums[EnumCellIndex.中电芯].AirPorts[(int)EnumVacuumIndex.中真空].Port =
         ThisOutport(EnumOutportName.SortingPNPVacMidCent);
     CellVacuums[EnumCellIndex.中电芯].AirPorts[(int)EnumVacuumIndex.前真空].Port =
         ThisOutport(EnumOutportName.SortingPNPVacMidFront);
     CellVacuums[EnumCellIndex.右电芯].MainPort.Port =
         ThisOutport(EnumOutportName.SortingPNPVacRight);
     CellVacuums[EnumCellIndex.右电芯].AirPorts[(int)EnumVacuumIndex.后真空].Port =
         ThisOutport(EnumOutportName.SortingPNPVacRightBack);
     CellVacuums[EnumCellIndex.右电芯].AirPorts[(int)EnumVacuumIndex.中真空].Port =
         ThisOutport(EnumOutportName.SortingPNPVacRightCent);
     CellVacuums[EnumCellIndex.右电芯].AirPorts[(int)EnumVacuumIndex.前真空].Port =
         ThisOutport(EnumOutportName.SortingPNPVacRightFront);
     CellBlow.Port = ThisOutport(EnumOutportName.SortingPNPBlow);
     CellVacSensor[EnumCellIndex.左电芯].Port = ThisInport(EnumInportName.SortingPNPVacSensLeft);
     CellVacSensor[EnumCellIndex.中电芯].Port = ThisInport(EnumInportName.SortingPNPVacSensMid);
     CellVacSensor[EnumCellIndex.右电芯].Port = ThisInport(EnumInportName.SortingPNPVacSensRight);
     ZoneSettingPanel = new SettingPanelZoneNG挑选机械手();
     ZoneManualPanel  = new ManualPanelZoneNG挑选机械手();
 }
Пример #2
0
        /// <summary>
        /// PNP电机移到到指定位置
        /// </summary>
        /// <param name="action"></param>
        public ErrorInfoWithPause ActionMove(EnumPointPNPY action)
        {
            string             err = "";
            ErrorInfoWithPause res = null;

            while (true)
            {
                err = "";
                PNPCylinder[EnumCellIndex.左电芯].SetCylinderState(CYLIND_UP, 0, false);
                PNPCylinder[EnumCellIndex.中电芯].SetCylinderState(CYLIND_UP, 0, false);
                PNPCylinder[EnumCellIndex.右电芯].SetCylinderState(CYLIND_UP, 0, false);
                if (!PNPCylinder[EnumCellIndex.左电芯].WaitCylinderState(CYLIND_UP, ClassErrorHandle.TIMEOUT))
                {
                    err += " 左气缸";
                }
                if (!PNPCylinder[EnumCellIndex.中电芯].WaitCylinderState(CYLIND_UP, ClassErrorHandle.TIMEOUT))
                {
                    err += " 中气缸";
                }
                if (!PNPCylinder[EnumCellIndex.右电芯].WaitCylinderState(CYLIND_UP, ClassErrorHandle.TIMEOUT))
                {
                    err += " 右气缸";
                }
                if (err != "")// return new ErrorInfoWithPause("NG挑选PNP气缸上移超时错:" + err, ErrorLevel.Alarm, false, true);
                {
                    res = WaitAlarmPause("NG挑选PNP移动", "NG挑选PNP气缸上移超时错: " + err);
                    if (res != null)
                    {
                        return(res);
                    }
                }
                else
                {
                    break;
                }
            }
            while (!AxisSortingPNPZ.MoveTo(EnumPointPNPZ.Up)) //return DispMotionError(AxisSortingPNPZ, EnumPointPNPZ.Up);
            {
                res = DispMotionError(AxisSortingPNPZ, EnumPointPNPZ.Up);
                if (res != null)
                {
                    return(res);
                }
            }
            while (!AxisSortingPNPY.MoveTo(action)) //return DispMotionError(AxisSortingPNPY, action);
            {
                res = DispMotionError(AxisSortingPNPY, action);
                if (res != null)
                {
                    return(res);
                }
            }
            return(null);
        }
Пример #3
0
        public ErrorInfoWithPause ActionSortPNPStartPick(CallBackCommonFunc ActionSortPNPPick, CallBackCommonFunc AfterActionSortPNPPick)
        {
            ErrorInfoWithPause res = null;

            //PNP Z down
            while (!AxisSortingPNPZ.MoveTo(EnumPointPNPZ.Pick, true, ClassCommonSetting.SysParam.CurrentProductParam.CellDataSpec.CellThickness.Mean - 1))
            //return DispMotionError(AxisSortingPNPZ, EnumPointPNPZ.Pick);
            {
                res = DispMotionError(AxisSortingPNPZ, EnumPointPNPZ.Pick);
                if (res != null)
                {
                    return(res);
                }
            }
            //Start picking
            if (ActionSortPNPPick != null)
            {
                ActionSortPNPPick();
            }
            //PNP Z up
            while (!AxisSortingPNPZ.MoveTo(EnumPointPNPZ.Up)) //return DispMotionError(AxisSortingPNPZ, EnumPointPNPZ.Up);
            {
                res = DispMotionError(AxisSortingPNPZ, EnumPointPNPZ.Up);
                if (res != null)
                {
                    return(res);
                }
            }
            if (AfterActionSortPNPPick != null)
            {
                AfterActionSortPNPPick();
            }
            //Check vacuum
            System.Threading.Thread.Sleep(100);
            res = CheckVacuumStatus();
            return(res);
        }
Пример #4
0
        public ErrorInfoWithPause ActionSortPNPStartPlaceNG(CallBackCommonFunc AfterActionSortPNPPlaceNG)
        {
            ErrorInfoWithPause res = null;

            //Check vacuum
            res = CheckVacuumStatus();
            if (res != null)
            {
                return(res);
            }
            bool NeedCylinderDown;

            //res = UpdateRow();
            //if (res != null) return res;
            if (ClassWorkFlow.Instance.UnloadMode != EnumUnloadMode.全NG)
            {
                for (int i = 0; i < CELLCOUNT; i++)
                {
                    if (CheckCellIsNG(SortNGDataStations[i].CellData))
                    {
                        if (IsUseBackNGBox)
                        {
                            if (SortNGDataStations[i].CellData.ThicknessNG)
                            {
                                CurrentNGBoxRow = (int)EnumPointPNPY.NGBox1;
                            }
                            else
                            {
                                CurrentNGBoxRow = (int)EnumPointPNPY.NGBox2;
                            }
                        }
                        else
                        {
                            if (SortNGDataStations[i].CellData.ThicknessNG)
                            {
                                CurrentNGBoxRow = (int)EnumPointPNPY.NGBox3;
                            }
                            else
                            {
                                CurrentNGBoxRow = (int)EnumPointPNPY.NGBox4;
                            }
                        }
                        NGBoxCellCount[CurrentNGBoxRow, i]++;
                        string NGData = SortNGDataStations[i].CellData.NGDataInfoString;
                        if (NGData != "")
                        {
                            NGBoxDataInfoString[CurrentNGBoxRow, i] += NGData + Environment.NewLine;
                        }
                        NeedCylinderDown = CheckIfNeedCylinder(NGBoxCellCount[CurrentNGBoxRow, i]);

                        //PNP Y move away
                        res = ActionMove((EnumPointPNPY)CurrentNGBoxRow);
                        if (res != null)
                        {
                            return(res);
                        }
                        if (NeedCylinderDown)
                        {
                            //PNP Z down
                            while (!AxisSortingPNPZ.MoveTo(EnumPointPNPZ.Place, true, 1 + NGBoxCellCount[CurrentNGBoxRow, i] * ClassCommonSetting.SysParam.CurrentProductParam.CellDataSpec.CellThickness.Mean))
                            //return DispMotionError(AxisSortingPNPZ, EnumPointPNPZ.Place);
                            {
                                res = DispMotionError(AxisSortingPNPZ, EnumPointPNPZ.Place);
                                if (res != null)
                                {
                                    return(res);
                                }
                            }
                            //Cylinder down
                            while (!PNPCylinder[i].SetCylinderState(CYLIND_DOWN, ClassErrorHandle.TIMEOUT))
                            //return new ErrorInfoWithPause("NG挑选PNP气缸下移超时错。", ErrorLevel.Error);
                            {
                                res = WaitAlarmPause("NG挑选PNP放料", "NG挑选PNP气缸下移超时错");
                                if (res != null)
                                {
                                    return(res);
                                }
                            }
                        }
                        else
                        {
                            //PNP Z down
                            while (!AxisSortingPNPZ.MoveTo(EnumPointPNPZ.Place, true, -100 + 1 + GetMaxCount() * ClassCommonSetting.SysParam.CurrentProductParam.CellDataSpec.CellThickness.Mean))
                            //return DispMotionError(AxisSortingPNPZ, EnumPointPNPZ.Place);
                            {
                                res = DispMotionError(AxisSortingPNPZ, EnumPointPNPZ.Place);
                                if (res != null)
                                {
                                    return(res);
                                }
                            }
                        }
                        //Open blow
                        AirControl((EnumCellIndex)i, EnumAirControl.Blow);
                        //AirControl((EnumCellIndex)i, EnumAirControl.Close);
                        //Delay
                        TimeClass.Delay(400);
                        //Cylinder up
                        while (!PNPCylinder[i].SetCylinderState(CYLIND_UP, ClassErrorHandle.TIMEOUT))
                        //return new ErrorInfoWithPause("NG挑选PNP气缸上移超时错。", ErrorLevel.Error);
                        {
                            res = WaitAlarmPause("NG挑选PNP放料", "NG挑选PNP气缸上移超时错");
                            if (res != null)
                            {
                                return(res);
                            }
                        }
                        //Close blow
                        AirControl((EnumCellIndex)i, EnumAirControl.Close);
                    }
                }
            }
            else
            {
                for (int i = 0; i < CELLCOUNT; i++)
                {
                    if (CheckCellIsNG(SortNGDataStations[i].CellData))
                    {
                        NGBoxCellCount[CurrentNGBoxRow, i]++;
                    }
                }
                NeedCylinderDown = CheckIfNeedCylinder(GetMaxCount());

                //PNP Y move away
                res = ActionMove((EnumPointPNPY)CurrentNGBoxRow);
                if (res != null)
                {
                    return(res);
                }
                if (NeedCylinderDown)
                {
                    //PNP Z down
                    while (!AxisSortingPNPZ.MoveTo(EnumPointPNPZ.Place, true, 1 + GetMaxCount() * ClassCommonSetting.SysParam.CurrentProductParam.CellDataSpec.CellThickness.Mean))
                    //return DispMotionError(AxisSortingPNPZ, EnumPointPNPZ.Place);
                    {
                        res = DispMotionError(AxisSortingPNPZ, EnumPointPNPZ.Place);
                        if (res != null)
                        {
                            return(res);
                        }
                    }
                    //Cylinder down
                    PNPCylinder[0].SetCylinderState(CYLIND_DOWN, 0, false);
                    PNPCylinder[1].SetCylinderState(CYLIND_DOWN, 0, false);
                    PNPCylinder[2].SetCylinderState(CYLIND_DOWN, 0, false);
                    while (!PNPCylinder[0].WaitCylinderState(CYLIND_DOWN, ClassErrorHandle.TIMEOUT) || !PNPCylinder[1].WaitCylinderState(CYLIND_DOWN, ClassErrorHandle.TIMEOUT) || !PNPCylinder[2].WaitCylinderState(CYLIND_DOWN, ClassErrorHandle.TIMEOUT))
                    //return new ErrorInfoWithPause("NG挑选PNP气缸下移超时错。", ErrorLevel.Error);
                    {
                        res = WaitAlarmPause("NG挑选PNP放料", "NG挑选PNP气缸下移超时错");
                        if (res != null)
                        {
                            return(res);
                        }
                    }
                }
                else
                {
                    //PNP Z down
                    while (!AxisSortingPNPZ.MoveTo(EnumPointPNPZ.Place, true, -100 + 1 + GetMaxCount() * ClassCommonSetting.SysParam.CurrentProductParam.CellDataSpec.CellThickness.Mean))
                    //return DispMotionError(AxisSortingPNPZ, EnumPointPNPZ.Place);
                    {
                        res = DispMotionError(AxisSortingPNPZ, EnumPointPNPZ.Place);
                        if (res != null)
                        {
                            return(res);
                        }
                    }
                }
                //Open blow
                AirControl(EnumAirControl.Blow, EnumAirControl.Blow, EnumAirControl.Blow);
                //AirControl(EnumAirControl.Close, EnumAirControl.Close, EnumAirControl.Close);
                //Delay
                TimeClass.Delay(400);
                //Cylinder up
                PNPCylinder[0].SetCylinderState(CYLIND_UP, 0, false);
                PNPCylinder[1].SetCylinderState(CYLIND_UP, 0, false);
                PNPCylinder[2].SetCylinderState(CYLIND_UP, 0, false);
                while (!PNPCylinder[0].WaitCylinderState(CYLIND_UP, ClassErrorHandle.TIMEOUT) || !PNPCylinder[1].WaitCylinderState(CYLIND_UP, ClassErrorHandle.TIMEOUT) || !PNPCylinder[2].WaitCylinderState(CYLIND_UP, ClassErrorHandle.TIMEOUT))
                //return new ErrorInfoWithPause("NG挑选PNP气缸上移超时错。", ErrorLevel.Error);
                {
                    res = WaitAlarmPause("NG挑选PNP放料", "NG挑选PNP气缸上移超时错");
                    if (res != null)
                    {
                        return(res);
                    }
                }
                //Close blow
                AirControl(EnumAirControl.Close, EnumAirControl.Close, EnumAirControl.Close);
            }

            //PNP Z up
            while (!AxisSortingPNPZ.MoveTo(EnumPointPNPZ.Up)) //return DispMotionError(AxisSortingPNPZ, EnumPointPNPZ.Up);
            {
                res = DispMotionError(AxisSortingPNPZ, EnumPointPNPZ.Up);
                if (res != null)
                {
                    return(res);
                }
            }
            DoUpdateNGBox();
            //PNP Y move away
            while (!AxisSortingPNPY.MoveTo(EnumPointPNPY.Pick)) //return DispMotionError(AxisSortingPNPY, EnumPointPNPY.Pick);
            {
                res = DispMotionError(AxisSortingPNPY, EnumPointPNPZ.Pick);
                if (res != null)
                {
                    return(res);
                }
            }
            if (AfterActionSortPNPPlaceNG != null)
            {
                AfterActionSortPNPPlaceNG();
            }
            NGBoxFullErrorHandler(this.Name, "", ErrorDialogResult.OK);
            return(null);
        }