public override void ZoneInit() { base.ZoneInit(); AssignHardware(typeof(EnumAxisName), typeof(EnumInportName), typeof(EnumOutportName)); AxisLoadPNPY = ThisAxis(EnumAxisName.LoadPNPY); AxisLoadPNPY.AddPoints(typeof(EnumPointY)); AxisLoadPNPZ = ThisAxis(EnumAxisName.LoadPNPZ); AxisLoadPNPZ.AddPoints(typeof(EnumPointZ)); NGBoxFullSensor = ThisInport(EnumInportName.LoadPNPNGBoxFull); NGBoxSensor = ThisInport(EnumInportName.LoadPNPNGBox); PNPCylinder.Add(EnumCellIndex.左电芯, new CylinderControl(/*"左电芯Z气缸", "下降", "上升",*/ ThisOutport(EnumOutportName.LoadPNPCyLeftDown), ThisOutport(EnumOutportName.LoadPNPCyLeftUp), ThisInport(EnumInportName.LoadPNPCyLeftDown), ThisInport(EnumInportName.LoadPNPCyLeftUp))); PNPCylinder.Add(EnumCellIndex.中电芯, new CylinderControl(/*"中电芯Z气缸", "下降", "上升",*/ ThisOutport(EnumOutportName.LoadPNPCyMidDown), ThisOutport(EnumOutportName.LoadPNPCyMidUp), ThisInport(EnumInportName.LoadPNPCyMidDown), ThisInport(EnumInportName.LoadPNPCyMidUp))); PNPCylinder.Add(EnumCellIndex.右电芯, new CylinderControl(/*"右电芯Z气缸", "下降", "上升",*/ ThisOutport(EnumOutportName.LoadPNPCyRightDown), ThisOutport(EnumOutportName.LoadPNPCyRightUp), ThisInport(EnumInportName.LoadPNPCyRightDown), ThisInport(EnumInportName.LoadPNPCyRightUp))); CellVacuums[EnumCellIndex.左电芯].MainPort.Port = ThisOutport(EnumOutportName.LoadPNPVacLeft); CellVacuums[EnumCellIndex.左电芯].AirPorts[(int)EnumVacuumIndex.后真空].Port = ThisOutport(EnumOutportName.LoadPNPVacLeftBack); CellVacuums[EnumCellIndex.左电芯].AirPorts[(int)EnumVacuumIndex.中真空].Port = ThisOutport(EnumOutportName.LoadPNPVacLeftCent); CellVacuums[EnumCellIndex.左电芯].AirPorts[(int)EnumVacuumIndex.前真空].Port = ThisOutport(EnumOutportName.LoadPNPVacLeftFront); CellVacuums[EnumCellIndex.中电芯].MainPort.Port = ThisOutport(EnumOutportName.LoadPNPVacMid); CellVacuums[EnumCellIndex.中电芯].AirPorts[(int)EnumVacuumIndex.后真空].Port = ThisOutport(EnumOutportName.LoadPNPVacMidBack); CellVacuums[EnumCellIndex.中电芯].AirPorts[(int)EnumVacuumIndex.中真空].Port = ThisOutport(EnumOutportName.LoadPNPVacMidCent); CellVacuums[EnumCellIndex.中电芯].AirPorts[(int)EnumVacuumIndex.前真空].Port = ThisOutport(EnumOutportName.LoadPNPVacMidFront); CellVacuums[EnumCellIndex.右电芯].MainPort.Port = ThisOutport(EnumOutportName.LoadPNPVacRight); CellVacuums[EnumCellIndex.右电芯].AirPorts[(int)EnumVacuumIndex.后真空].Port = ThisOutport(EnumOutportName.LoadPNPVacRightBack); CellVacuums[EnumCellIndex.右电芯].AirPorts[(int)EnumVacuumIndex.中真空].Port = ThisOutport(EnumOutportName.LoadPNPVacRightCent); CellVacuums[EnumCellIndex.右电芯].AirPorts[(int)EnumVacuumIndex.前真空].Port = ThisOutport(EnumOutportName.LoadPNPVacRightFront); CellBlow[EnumCellIndex.左电芯].Port = ThisOutport(EnumOutportName.LoadPNPBlowLeft); CellBlow[EnumCellIndex.中电芯].Port = ThisOutport(EnumOutportName.LoadPNPBlowMid); CellBlow[EnumCellIndex.右电芯].Port = ThisOutport(EnumOutportName.LoadPNPBlowRight); CellVacSensor[EnumCellIndex.左电芯].Port = ThisInport(EnumInportName.LoadPNPVacSensLeft); CellVacSensor[EnumCellIndex.中电芯].Port = ThisInport(EnumInportName.LoadPNPVacSensMid); CellVacSensor[EnumCellIndex.右电芯].Port = ThisInport(EnumInportName.LoadPNPVacSensRight); ZoneSettingPanel = new SettingPanelZone上料机械手(); ZoneManualPanel = new ManualPanelZone上料机械手(); DoUpdateNGBox(); ProductChangeHandler(null, null); }
public ErrorInfoWithPause ActionLoadPNPStartPlace(CallBackCommonFunc ActionPlace, CallBackCommonFunc AfterActionPlace) { ErrorInfoWithPause res; //Check vacuum res = CheckVacuumStatus(); if (res != null) { return(res); } //PNP Z down while (!AxisLoadPNPZ.MoveTo(EnumPointZ.Place, true, ClassCommonSetting.SysParam.CurrentProductParam.CellDataSpec.CellThickness.Mean + 1)) //return DispMotionError(AxisLoadPNPZ, EnumPointZ.Place); { res = DispMotionError(AxisLoadPNPZ, EnumPointZ.Place); if (res != null) { return(res); } } //Start placing if (ActionPlace != null) { ActionPlace(); } //PNP Z up while (!AxisLoadPNPZ.MoveTo(EnumPointZ.Idle)) //return DispMotionError(AxisLoadPNPZ, EnumPointZ.Idle); { res = DispMotionError(AxisLoadPNPZ, EnumPointZ.Idle); if (res != null) { return(res); } } //if (!ClassCommonSetting.CheckTimeOut(() => MotorSafetyCheck.GreaterThanPosition(AxisLoadPNPZ, EnumPointZ.Idle, -5))) // return DispMotionError(AxisLoadPNPZ, EnumPointZ.Idle); //Close air AirControl((LoadPNPDataStations[EnumCellIndex.左电芯].CellData != null && LoadPNPDataStations[EnumCellIndex.左电芯].CellData.LoadNG) ? EnumAirControl.Vacuum : EnumAirControl.Close, (LoadPNPDataStations[EnumCellIndex.中电芯].CellData != null && LoadPNPDataStations[EnumCellIndex.中电芯].CellData.LoadNG) ? EnumAirControl.Vacuum : EnumAirControl.Close, (LoadPNPDataStations[EnumCellIndex.右电芯].CellData != null && LoadPNPDataStations[EnumCellIndex.右电芯].CellData.LoadNG) ? EnumAirControl.Vacuum : EnumAirControl.Close); //PNP Y move away while (!AxisLoadPNPY.MoveTo(EnumPointY.Pick, false)) //return DispMotionError(AxisLoadPNPY, EnumPointY.Pick); { res = DispMotionError(AxisLoadPNPY, EnumPointY.Pick); if (res != null) { return(res); } } if (AfterActionPlace != null) { AfterActionPlace(); } return(null); }
/// <summary> /// PNP电机移到到指定位置 /// </summary> /// <param name="action"></param> public ErrorInfoWithPause ActionMove(EnumPointY action) { ErrorInfoWithPause res = null; string temp = ""; while (true) { temp = ""; 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)) { temp = " 左气缸"; } if (!PNPCylinder[EnumCellIndex.中电芯].WaitCylinderState(CYLIND_UP, ClassErrorHandle.TIMEOUT)) { temp = " 中气缸"; } if (!PNPCylinder[EnumCellIndex.右电芯].WaitCylinderState(CYLIND_UP, ClassErrorHandle.TIMEOUT)) { temp = " 右气缸"; } if (temp != "") //return new ErrorInfoWithPause("气缸上移超时错:" + temp, ErrorLevel.Error); { res = WaitAlarmPause("上料PNP移动", "气缸上移超时错: " + temp); if (res != null) { return(res); } } else { break; } } while (!AxisLoadPNPZ.MoveTo(EnumPointZ.Idle)) //return DispMotionError(AxisLoadPNPZ, EnumPointZ.Idle); { res = DispMotionError(AxisLoadPNPZ, EnumPointZ.Idle); if (res != null) { return(res); } } while (!AxisLoadPNPY.MoveTo(action)) //return DispMotionError(AxisLoadPNPY, action); { res = DispMotionError(AxisLoadPNPY, action); if (res != null) { return(res); } } return(null); }
public ErrorInfoWithPause ActionLoadPNPStartPick(CallBackCommonFunc ActionPick, CallBackCommonFunc AfterActionPick) { ErrorInfoWithPause res = null; //PNP Z down while (!AxisLoadPNPZ.MoveTo(EnumPointZ.Pick, true, ClassCommonSetting.SysParam.CurrentProductParam.CellDataSpec.CellThickness.Mean - 1)) //return DispMotionError(AxisLoadPNPZ, EnumPointZ.Pick); { res = DispMotionError(AxisLoadPNPZ, EnumPointZ.Pick); if (res != null) { return(res); } } //Start picking if (ActionPick != null) { ActionPick(); } //PNP Z up while (!AxisLoadPNPZ.MoveTo(EnumPointZ.Idle)) //return DispMotionError(AxisLoadPNPZ, EnumPointZ.Idle); { res = DispMotionError(AxisLoadPNPZ, EnumPointZ.Idle); if (res != null) { return(res); } } //TimeClass.Delay(500); if (AfterActionPick != null) { AfterActionPick(); } //Check vacuum res = CheckVacuumStatus(); return(res); }
public ErrorInfoWithPause ActionLoadPNPStartPlaceNG(CallBackCommonFunc AfterActionPlaceNG) { ErrorInfoWithPause res; bool NeedCylinderDown; for (int i = 0; i < CELLCOUNT; i++) { if (LoadPNPDataStations[i].CellData != null && LoadPNPDataStations[i].CellData.LoadNG) { NGBoxCellCount[i]++; NeedCylinderDown = CheckIfNeedCylinder(NGBoxCellCount[i]); if (NeedCylinderDown) { //PNP Z down while (!AxisLoadPNPZ.MoveTo(EnumPointZ.PlaceNG, true, 1 + NGBoxCellCount[i] * ClassCommonSetting.SysParam.CurrentProductParam.CellDataSpec.CellThickness.Mean)) //return DispMotionError(AxisLoadPNPZ, EnumPointZ.PlaceNG); { res = DispMotionError(AxisLoadPNPZ, EnumPointZ.PlaceNG); if (res != null) { return(res); } } //Cylinder down if (!PNPCylinder[i].SetCylinderState(CYLIND_DOWN, ClassErrorHandle.TIMEOUT)) { return(new ErrorInfoWithPause("上料PNP气缸下移超时错。", ErrorLevel.Error)); } } else { //PNP Z down while (!AxisLoadPNPZ.MoveTo(EnumPointZ.PlaceNG, true, -100 + 1 + GetMaxCount() * ClassCommonSetting.SysParam.CurrentProductParam.CellDataSpec.CellThickness.Mean)) //return DispMotionError(AxisLoadPNPZ, EnumPointZ.PlaceNG); { res = DispMotionError(AxisLoadPNPZ, EnumPointZ.PlaceNG); if (res != null) { return(res); } } } //Open blow AirControl((EnumCellIndex)i, EnumAirControl.Blow); //Delay System.Threading.Thread.Sleep(ClassCommonSetting.SysParam.VacuumDelayTime); //Cylinder up while (!PNPCylinder[i].SetCylinderState(CYLIND_UP, ClassErrorHandle.TIMEOUT)) //return new ErrorInfoWithPause("上料PNP气缸上移超时错。", ErrorLevel.Error); { res = WaitAlarmPause("上料PNP放NG料", "上料PNP气缸上移超时错"); if (res != null) { return(res); } } //Close blow AirControl((EnumCellIndex)i, EnumAirControl.Close); } } //PNP Z up while (!AxisLoadPNPZ.MoveTo(EnumPointZ.Idle)) //return DispMotionError(AxisLoadPNPZ, EnumPointZ.Idle); { res = DispMotionError(AxisLoadPNPZ, EnumPointZ.Idle); if (res != null) { return(res); } } DoUpdateNGBox(); NGBoxFullErrorHandler("NGBox", "", ErrorDialogResult.OK); //PNP Y move away while (!AxisLoadPNPY.MoveTo(EnumPointY.Pick)) //return DispMotionError(AxisLoadPNPY, EnumPointY.Pick); { res = DispMotionError(AxisLoadPNPY, EnumPointY.Pick); if (res != null) { return(res); } } if (AfterActionPlaceNG != null) { AfterActionPlaceNG(); } return(null); }