public static bool InspectEmergency() { bool isOk = true; //Check Emergency if (ML.IO_GetX(xi.LODR_EmgSw1) || ML.IO_GetX(xi.ETC_EmgSw2) || ML.IO_GetX(xi.ETC_EmgSw3) || ML.IO_GetX(xi.ULDR_EmgSw4)) { ML.MT_EmgStopAll(); ML.MT_SetServoAll(false); if (ML.IO_GetX(xi.LODR_EmgSw1)) { ML.ER_SetErr(ei.ETC_Emergency, "Loader Emergency Switch pushed."); } if (ML.IO_GetX(xi.ETC_EmgSw2)) { ML.ER_SetErr(ei.ETC_Emergency, "Main1 Emergency Switch pushed."); } if (ML.IO_GetX(xi.ETC_EmgSw3)) { ML.ER_SetErr(ei.ETC_Emergency, "Main2 Emergency Switch pushed."); } if (ML.IO_GetX(xi.ULDR_EmgSw4)) { ML.ER_SetErr(ei.ETC_Emergency, "Unloader Emergency Switch pushed."); } isOk = false; } return(isOk); }
public static bool InspectEmergency() { bool isOk = true; //Check Emergency if (ML.IO_GetX(xi.ETC_LEmgSw) || ML.IO_GetX(xi.ETC_REmgSw) || ML.IO_GetX(xi.ETC_LDREmgSw) || ML.IO_GetX(xi.ETC_ULDEmgSw)) { ML.MT_EmgStopAll(); ML.MT_SetServoAll(false); if (ML.IO_GetX(xi.ETC_LEmgSw)) { ML.ER_SetErr(ei.ETC_Emergency, "좌측 Emergency Switch 가 눌렸습니다."); } if (ML.IO_GetX(xi.ETC_REmgSw)) { ML.ER_SetErr(ei.ETC_Emergency, "우측 Emergency Switch 가 눌렸습니다."); } if (ML.IO_GetX(xi.ETC_LDREmgSw)) { ML.ER_SetErr(ei.ETC_Emergency, "로더 Emergency Switch 가 눌렸습니다."); } if (ML.IO_GetX(xi.ETC_ULDEmgSw)) { ML.ER_SetErr(ei.ETC_Emergency, "언로더 Emergency Switch 가 눌렸습니다."); } isOk = false; } return(isOk); }
public static bool InspectMotor() { //Local Var. bool isOk = true; for (int i = 0; i < (int)mi.MAX_MOTR; i++) { if (ML.MT_GetAlarmSgnl(i)) { if (ML.MT_GetServo(i)) { ML.MT_SetServo(i, false); } ML.ER_SetErr(ei.MTR_Alarm, ML.MT_GetName(i)); isOk = false; } if (ML.MT_GetHomeDone(i)) { if (ML.MT_GetNLimSnsr(i)) { ML.ER_SetErr(ei.MTR_NegLim, ML.MT_GetName(i)); isOk = false; } if (ML.MT_GetPLimSnsr(i)) { ML.ER_SetErr(ei.MTR_PosLim, ML.MT_GetName(i)); isOk = false; } } } //Ok. return(isOk); }
public static bool ToStop() //스탑을 하기 위한 함수. { bool[] bRet = new bool[(int)pi.MAX_PART]; for (int i = 0; i < (int)pi.MAX_PART; i++) { string errorMsg = null; try { int step = (int)EN_SEQ_STEP.ToStop; Interpreter.Instance.Process("set(seq.Step," + step.ToString() + ")"); bRet[i] = Interpreter.Instance.Process(Interpreter.script); } catch (ArgumentException exc) { errorMsg = exc.Message; } if (!string.IsNullOrWhiteSpace(errorMsg)) { ML.ER_SetErr(ei.Script_Grammar); return(true); } } for (int i = 0; i < (int)pi.MAX_PART; i++) { if (!bRet[i]) { return(false); } } return(true); }
public static bool InspectMotor() { //Local Var. bool isOk = true; for (mi i = 0; i < mi.MAX_MOTR; i++) { if (ML.MT_GetAlarmSgnl(i)) { ML.ER_SetErr(ei.MTR_Alarm, ML.MT_GetName(i)); isOk = false; } if (ML.MT_GetHomeDone(i)) { if (ML.MT_GetNLimSnsr(i)) { ML.ER_SetErr(ei.MTR_NegLim, ML.MT_GetName(i)); isOk = false; } if (ML.MT_GetPLimSnsr(i)) { ML.ER_SetErr(ei.MTR_PosLim, ML.MT_GetName(i)); isOk = false; } } } //스텝모터 체크 bool bCheck = false; bool bCheck1 = ML.MT_GetStop(mi.OUT_TRelB); bool bCheck2 = ML.MT_GetStop(mi.OUT_TRelT); bool bCheck3 = ML.MT_GetStop(mi.OUT_YGuid); if (!OM.CmnOptn.bRewindMode) { if (m_tmMotor1.OnDelay(!bCheck1, 10000)) { ML.ER_SetErr(ei.MTR_Alarm, ML.MT_GetName(mi.OUT_TRelB) + " 과부하 정지"); bCheck = true; } if (m_tmMotor2.OnDelay(!bCheck2, 10000)) { ML.ER_SetErr(ei.MTR_Alarm, ML.MT_GetName(mi.OUT_TRelT) + " 과부하 정지"); bCheck = true; } if (m_tmMotor3.OnDelay(!bCheck3, 10000)) { ML.ER_SetErr(ei.MTR_Alarm, ML.MT_GetName(mi.OUT_YGuid) + " 과부하 정지"); bCheck = true; } } if (bCheck) { ML.MT_Stop(mi.OUT_TRelB); ML.MT_Stop(mi.OUT_TRelT); ML.MT_Stop(mi.OUT_YGuid); } //Ok. return(isOk); }
//Functions. //Inspection Machine Status. public static bool InspectMainAir() { bool isOk = true; if (!ML.IO_GetX(xi.ETC_MainAir)) { ML.ER_SetErr((int)ei.ETC_MainAir, "Cheked Main Air"); isOk = false; } return(isOk); }
public static bool CycleManMove(double _dDist) { string sTemp; if (m_tmCycle.OnDelay(m_iManStep != 0 && m_iManStep == m_iPreManStep && !OM.MstOptn.bDebugMode, 10000)) { sTemp = string.Format("m_iManStep ={0:00}", m_iManStep); sTemp = "Manual Man" + sTemp; ML.ER_SetErr(ei.ETC_ManCycleTO, sTemp); Log.Trace("Manual Man", sTemp); m_iManStep = 0; return(true); } if (m_iManStep != m_iPreManStep) { sTemp = string.Format("Home m_iManStep={0:00}", m_iManStep); Log.Trace("MAnual Man", sTemp); } bool bRet1 = false; bool bRet2 = false; m_iPreManStep = m_iManStep; switch (m_iManStep) { default: sTemp = string.Format("Cycle Default Clear Manual m_iPreManStep ={0:00}", m_iPreManStep); m_iManStep = 0; return(true); case 10: SEQ.WRK.InitCycleStep(); SEQ.OUT.InitCycleStep(); m_iManStep++; return(false); case 11: bRet1 = SEQ.WRK.CycleManMove(_dDist); bRet2 = SEQ.OUT.CycleWind(); if (!bRet1 || !bRet2) { return(false); } m_iManStep = 0; return(true); } }
private void button2_Click_1(object sender, EventArgs e) { //SPC.LOT.Data.Device = RandomStr().toString(); //SPC.ERR.Data.LotNo = GetRandomStr(8); Random ran = new Random(); ML.ER_SetErr((ei)(ran.Next(0, (int)ei.MAX_ERR - 1)), "sunsunsunsun"); //SPC.LOT.SaveDataIni(); }
public static bool InspectDoor() { //Local Var. bool isOk = true; if (!ML.IO_GetX(xi.ETC_FDoor)) { ML.ER_SetErr(ei.ETC_Door, "Front Door Opened"); isOk = false; } if (!ML.IO_GetX(xi.ETC_RDoor)) { ML.ER_SetErr(ei.ETC_Door, "Rear Door Opened"); isOk = false; } //Ok. return(isOk); }
public static bool InspectHomeDone() { //Local Var. bool isOk = true; //Inspect. for (int i = 0; i < (int)mi.MAX_MOTR; i++) { if (!ML.MT_GetHomeDone(i)) { ML.ER_SetErr(ei.MTR_HomeEnd, ML.MT_GetName(i)); isOk = false; } } //Ok. return(isOk); }
public static bool InspectActuator() { //Local Var. bool isOk = true; bool isErr = false; //Inspect. for (int i = 0; i < (int)ci.MAX_ACTR; i++) { isErr = ML.CL_Err((ci)i); if (isErr) { ML.ER_SetErr(ei.ATR_TimeOut, ML.CL_GetName((ci)i)); isOk = false; } } //Ok. return(isOk); }
private void btAllHome_Click(object sender, EventArgs e) { if (!ML.IO_GetY(yi.ETC_MainAirOnOff)) { ML.ER_SetErr(ei.ETC_MainAir, "메인 에어를 ON 해주세요."); return; } string sText = ((Button)sender).Text; Log.Trace(sFormText + sText + " Button Clicked", ForContext.Frm); if (!OM.MstOptn.bDebugMode) { if (Log.ShowMessageModal("Confirm", "Do you want to perform manual actions?") != DialogResult.Yes) { return; } MM.SetManCycle(mc.AllHome); } else { DialogResult Rslt; Rslt = MessageBox.Show("홈동작을 생략 하겠습니까?", "Confirm", MessageBoxButtons.YesNoCancel); if (Rslt == DialogResult.Yes) { ML.MT_SetServoAll(true); Thread.Sleep(100); for (mi i = 0; i < mi.MAX_MOTR; i++) { ML.MT_SetHomeDone(i, true); } } else if (Rslt == DialogResult.No) { MM.SetManCycle(mc.AllHome); } } }
public static bool Autorun() //오토런닝시에 계속 타는 함수. { bool[] bRet = new bool[(int)pi.MAX_PART]; for (int i = 0; i < (int)pi.MAX_PART; i++) { string errorMsg = null; try { int step = (int)EN_SEQ_STEP.Run; Interpreter.Instance.Process("set(seq.Step," + step.ToString() + ")"); bRet[i] = Interpreter.Instance.Process(Interpreter.script); } catch (ArgumentException exc) { errorMsg = exc.Message; } if (!string.IsNullOrWhiteSpace(errorMsg)) { ML.ER_SetErr(ei.Script_Grammar); return(true); } } //for(int i=(int)pi.MAX_PART-1; i >= 0; i--){ // bRet[i] = m_Part[i].Autorun(); //} for (int i = 0; i < (int)pi.MAX_PART; i++) { if (!bRet[i]) { return(false); } } //ML.ER.SetErrMsg((int)ei.PRT_TrayErr, "Have Not Tray"); return(true); }
private bool CycleJobChange() { if (tmTimeOut.OnDelay(iCycleStep != 0 && iCycleStep == iPreCycleStep, 3000)) { sErrMsg = string.Format(Para.Id.ToString() + " " + eSendingCmd.ToString() + " Cycle TimeOut iCycleStep={0:00}", iCycleStep); Log.Trace(sErrMsg); ML.ER_SetErr(ei.VSN_ComErr, sErrMsg); ML.IO_SetY(Para.yiJobStart, false); return(true); } if (iPreCycleStep != iCycleStep) { string sTemp = string.Format(Para.Id.ToString() + " " + eSendingCmd.ToString() + " Cycle iCycleStep={0:00}", iCycleStep); Log.Trace(sTemp); } iPreCycleStep = iCycleStep; switch (iCycleStep) { default: sErrMsg = string.Format(Para.Id.ToString() + " " + eSendingCmd.ToString() + " Cycle Default Clear at iCycleStep={0:00}", iCycleStep); Log.Trace(sErrMsg); ML.ER_SetErr(ei.VSN_ComErr, sErrMsg); ML.IO_SetY(Para.yiJobStart, false); return(true); case 10: if (!ML.IO_GetX(Para.xiVisnReady)) { sErrMsg = Para.Id.ToString() + " Vision Not Ready!"; ML.ER_SetErr(ei.VSN_ComErr, sErrMsg); return(true); } if (ML.IO_GetX(Para.xiVisnBusy)) { sErrMsg = Para.Id.ToString() + " Vision is Busy!"; ML.ER_SetErr(ei.VSN_ComErr, sErrMsg); return(true); } if (!WriteJob(sPara)) { //쓰기 실패. sErrMsg = Para.Id.ToString() + " Vision WriteJob Failed!"; ML.ER_SetErr(ei.VSN_ComErr, sErrMsg); return(true); } ML.IO_SetY(Para.yiJobStart, true); iCycleStep++; return(false); case 11: if (!ML.IO_GetX(Para.xiVisnBusy)) { return(false); } ML.IO_SetY(Para.yiJobStart, false); iCycleStep++; return(false); case 12: if (ML.IO_GetX(Para.xiVisnBusy)) { return(false); } iCycleStep++; return(false); case 13: return(true); } }
private static void UpdateButton() { //Check Inspect. //if (!OM.CmnOptn.bIgnrDoor) InspectDoor(); if (m_iStep != EN_SEQ_STEP.Idle) { InspectHomeDone(); } if (m_iStep == EN_SEQ_STEP.Idle) { InspectLightGrid(); } //Local Var. bool isErr = ML.ER_IsErr(); bool isHomeEnd = ML.MT_GetHomeDoneAll(); //vision manual button. //CDelayTimer tmVisnCycle ; //if(IO_GetX(xETC_LStopSw)&& m_iSeqStat == ssStop ){ //if(tmVisnCycle.OnDelay(true , 1000)) { // tmVisnCycle.Clear(); // if(MM.GetManNo() == mcNoneCycle) { // MM.SetManCycle(mcVSN_CycleWork); // } //} //} //else { //tmVisnCycle.Clear(); //} bool bStartSw = ML.IO_GetXUp(xi.ETC_LStartSw) || ML.IO_GetXUp(xi.ETC_RStartSw) || m_bBtnStart; // || ML.IO_GetXUp(xi.ETC_StartSwR) || m_bBtnStart ; bool bStopSw = ML.IO_GetXUp(xi.ETC_LStopSw) || ML.IO_GetXUp(xi.ETC_RStopSw) || m_bBtnStop; // || ML.IO_GetXUp(xi.ETC_StopSwR ) || m_bBtnStop ; bool bResetSw = ML.IO_GetXUp(xi.ETC_LResetSw) || ML.IO_GetXUp(xi.ETC_RResetSw) || m_bBtnReset; // || ML.IO_GetXUp(xi.ETC_ResetSwR) || m_bBtnReset ; bool bAirSw = ML.IO_GetXUp(xi.ETC_LAirSw) || ML.IO_GetXUp(xi.ETC_RAirSw) || m_bBtnAir; bool bInitSw = ML.IO_GetXUp(xi.ETC_LInitSw) || ML.IO_GetXUp(xi.ETC_RInitSw); if (m_bBtnStart) { Log.Trace("m_bBtnStart", "true"); } if (bStartSw) { Log.Trace("bStartSw", "Started"); if (MM.GetManNo() != (int)mc.NoneCycle) { Log.Trace("ManCycle", string.Format(MM.GetManNo().ToString())); bStartSw = false; } } //Update Switch's Lamp bool bStopBtnFlick = (m_iStep == EN_SEQ_STEP.ToStopCon || m_iStep == EN_SEQ_STEP.ToStop) && m_bFlick; //버튼 클릭시나 ML.IO_SetY(yi.ETC_LStartLp, ML.IO_GetX(xi.ETC_LStartSw) || m_bRun); ML.IO_SetY(yi.ETC_LStopLp, ML.IO_GetX(xi.ETC_LStopSw) || !m_bRun || bStopBtnFlick); ML.IO_SetY(yi.ETC_LResetLp, ML.IO_GetX(xi.ETC_LResetSw) || (m_bFlick && isErr)); ML.IO_SetY(yi.ETC_LAirLp, ML.IO_GetX(xi.ETC_LAirSw) || ML.IO_GetY(yi.ETC_MainAir)); ML.IO_SetY(yi.ETC_LInitLp, ML.IO_GetX(xi.ETC_LInitSw)); ML.IO_SetY(yi.ETC_RStartLp, ML.IO_GetX(xi.ETC_RStartSw) || m_bRun); ML.IO_SetY(yi.ETC_RStopLp, ML.IO_GetX(xi.ETC_RStopSw) || !m_bRun || bStopBtnFlick); ML.IO_SetY(yi.ETC_RResetLp, ML.IO_GetX(xi.ETC_RResetSw) || (m_bFlick && isErr)); ML.IO_SetY(yi.ETC_RAirLp, ML.IO_GetX(xi.ETC_RAirSw) || ML.IO_GetY(yi.ETC_MainAir)); ML.IO_SetY(yi.ETC_RInitLp, ML.IO_GetX(xi.ETC_RInitSw)); ML.IO_SetY(yi.ETC_Manual1, ML.IO_GetX(xi.ETC_Manual1)); ML.IO_SetY(yi.ETC_Manual2, ML.IO_GetX(xi.ETC_Manual2)); ML.IO_SetY(yi.ETC_Manual3, ML.IO_GetX(xi.ETC_Manual3)); ML.IO_SetY(yi.ETC_Manual4, ML.IO_GetX(xi.ETC_Manual4)); ML.IO_SetY(yi.ETC_Manual5, ML.IO_GetX(xi.ETC_Manual5)); // ML.IO_SetY(yi.ETC_StartLpR , ML.IO_GetX(xi.ETC_StartSwR ) || m_bRun ); // ML.IO_SetY(yi.ETC_StopLpR , ML.IO_GetX(xi.ETC_StopSwR ) || !m_bRun || bStopBtnFlick ); // ML.IO_SetY(yi.ETC_ResetLpR , ML.IO_GetX(xi.ETC_ResetSwR ) || (m_bFlick && isErr) ); ////ML.IO_SetY(yi.ETC_AirLp , ML.IO_GetX(xi.ETC_AirSw ) || ML.IO_GetY(yi.ETC_MainAirSol )); // ML.IO_SetY(yi.ETC_InitLpR , ML.IO_GetX(xi.ETC_InitSwR ) ); //Center Man Button m_bBtnStart = false; m_bBtnStop = false; m_bBtnReset = false; m_bBtnAir = false; //Init. Button Flags. if (bStartSw) { //bool bAllArayNone = DM.ARAY[riLSP].CheckAllStat(csNone) && DM.ARAY[riLDR].CheckAllStat(csNone) && DM.ARAY[riLST].CheckAllStat(csNone) && // DM.ARAY[riPSB].CheckAllStat(csNone) && DM.ARAY[riULD].CheckAllStat(csNone) && DM.ARAY[riVSN].CheckAllStat(csNone) ; if (!isHomeEnd) { Log.ShowMessage("Error", "장비 홈을 잡아주세요."); bStartSw = false; } //if(!LOT.GetLotOpen ()) { Log.ShowMessage("Error" , "장비 랏오픈을 해주세요."); bStartSw = false ; } if (!InspectStripDispr()) { m_bInspDispr = true; bStartSw = false; } if (!InspectStripUnknown()) { m_bInspUnkwn = true; bStartSw = false; } if (m_iSeqStat == EN_SEQ_STAT.WorkEnd || m_iSeqStat == EN_SEQ_STAT.RunWarn) { Reset(); } } if (bInitSw) { MM.SetManCycle(mc.AllHome); } //Air Switch. if (bAirSw && !m_bRun && m_iSeqStat != EN_SEQ_STAT.Init) { ML.IO_SetY(yi.ETC_MainAir, !ML.IO_GetY(yi.ETC_MainAir)); } //Buzzer Off. if (isErr && bStopSw) { ML.TL_SetBuzzOff(true); } //Set Condition Flags. if (bStartSw) //스타트버튼 안눌리는것 때문에 테스트. { Log.Trace("isErr", isErr ? "true":"false"); Log.Trace("ManualMan.GetManNo()", string.Format(MM.GetManNo().ToString())); } if (bStopSw) { Log.Trace("Stop", "Stop"); } bool isStopCon = bStopSw || (isErr && !m_bReqStop && m_bRun); bool isRunCon = bStartSw && !isErr /*&& ManualMan.GetManNo() == mcNone*/; bool isResetCon = bResetSw && !m_bRun; //Run. if (isRunCon && (m_iStep == EN_SEQ_STEP.Idle)) { m_iStep = EN_SEQ_STEP.ToStartCon; ML.TL_SetBuzzOff(false); ML.ER_SetDisp(true); } if (isRunCon && (m_iStep == EN_SEQ_STEP.Idle)) //스타트버튼 안눌리는것 때문에 테스트. { Log.Trace("isRunCon && m_iStep", string.Format(m_iStep.ToString())); } if (isStopCon && (m_iStep != EN_SEQ_STEP.Idle)) //스타트버튼 안눌리는것 때문에 테스트. { Log.Trace("isStopCon && m_iStep", string.Format(m_iStep.ToString())); Log.Trace("bStopSw", bStopSw ? "True" : "False"); Log.Trace("isErr", isErr ? "True" : "False"); Log.Trace("m_bReqStop", m_bReqStop ? "True" : "False"); Log.Trace("m_bRun", m_bRun ? "True" : "False"); m_bReqStop = true; } if (isResetCon && (m_iStep == EN_SEQ_STEP.Idle)) { Reset(); } if (m_tmToStrt.OnDelay(m_iStep == EN_SEQ_STEP.ToStartCon || m_iStep == EN_SEQ_STEP.ToStart, 30000)) { //Trace Log. string Msg; Msg = string.Format("ToStrtTimeOut : m_iStep=%d", m_iStep); Log.Trace("SEQ", Msg); ML.ER_SetErr(ei.ETC_ToStartTO); m_iStep = EN_SEQ_STEP.Idle; m_bRun = false; } //CDelayTimer StopBtn = null; //StopBtn = new CDelayTimer(); //if(m_iStep == EN_SEQ_STEP.scToStopCon) //{ // if(StopBtn.OnDelay(ML.IO_GetX((int)IP.xETC_StopSw)||ML.IO_GetX((int)IP.xETC_StopSw) , 5000)) // { // Log.Trace("SEQ","Forced Stop"); // m_bRun = false ; // m_iStep = EN_SEQ_STEP.scIdle; // m_bReqStop = false; // } //} //else //{ // StopBtn.Clear(); //} if (m_tmToStop.OnDelay(m_iStep == EN_SEQ_STEP.ToStopCon || m_iStep == EN_SEQ_STEP.ToStop, 30000)) // 20000)) { { //Trace Log. string Msg; Msg = string.Format("ToStopTimeOut : m_iStep=%d", m_iStep); Log.Trace("SEQ", Msg); m_bRun = false; ML.ER_SetErr(ei.ETC_ToStopTO); m_iStep = EN_SEQ_STEP.Idle; m_bReqStop = false; } EN_SEQ_STEP iPreStep = m_iStep; if (iPreStep != m_iStep) { string sMsg = ""; sMsg = "Step Changed" + string.Format(iPreStep.ToString()) + " -> " + string.Format(m_iStep.ToString()); Log.Trace("SEQ", sMsg); } iPreStep = m_iStep; //이상하게 중간에 랏엔드가 되는 현상 발견해서 넣어둠. bool bPreLotEnd = LOT.GetLotEnd(); if (LOT.GetLotEnd() != bPreLotEnd) { Log.Trace("SEQ", LOT.GetLotEnd() ? "LotEnd True" : "LotEnd False"); } bPreLotEnd = LOT.GetLotEnd(); //Running Step. switch (m_iStep) { case EN_SEQ_STEP.Idle: return; case EN_SEQ_STEP.ToStartCon: if (!ToStartCon()) { return; } m_iStep = EN_SEQ_STEP.ToStart; Log.Trace("SEQ", "scToStartCon END"); return; case EN_SEQ_STEP.ToStart: if (!ToStart()) { return; } m_bRun = true; m_bRunEdge = true; m_iStep = EN_SEQ_STEP.Run; Log.Trace("SEQ", "scToStart END"); return; case EN_SEQ_STEP.Run: if (!m_bReqStop) { if (Autorun()) { //랏엔드 상황. LOT.LotEnd(); Log.ShowMessage("Checked", "Lot Ended."); Log.Trace("SEQ", LOT.GetLotNo() + "LotEnd"); m_bRunEnd = true; m_iStep = EN_SEQ_STEP.ToStopCon; } return; } m_bReqStop = false; m_iStep = EN_SEQ_STEP.ToStopCon; Log.Trace("SEQ", "scRun END"); return; case EN_SEQ_STEP.ToStopCon: if (!ToStopCon()) { if (Autorun()) { //랏엔드 상황. LOT.LotEnd(); Log.Trace("SEQ", "scToStopCon LotEnd"); } return; } m_bRun = false; m_iStep = EN_SEQ_STEP.ToStop; Log.Trace("SEQ", "scToStopCon END"); return; case EN_SEQ_STEP.ToStop: if (!ToStop()) { return; } m_iStep = EN_SEQ_STEP.Idle; m_bReqStop = false; DM.SaveMap(); Log.Trace("SEQ", "scToStop END"); return; } }
private static void UpdateButton() { //Check Inspect. //if (!OM.CmnOptn.bIgnrDoor) InspectDoor(); if (m_iStep != EN_SEQ_STEP.Idle) { InspectHomeDone(); } if (m_iStep == EN_SEQ_STEP.Idle) { InspectLightGrid(); } //Local Var. bool isErr = ML.ER_IsErr(); bool bStartSw = ML.IO_GetXUp(xi.ETC_StartSw) || m_bBtnStart; // || ML.IO_GetXUp(xi.ETC_StartSwR) || m_bBtnStart ; bool bStopSw = ML.IO_GetXUp(xi.ETC_StopSw) || m_bBtnStop; // || ML.IO_GetXUp(xi.ETC_StopSwR ) || m_bBtnStop ; bool bResetSw = ML.IO_GetXUp(xi.ETC_ResetSw) || m_bBtnReset; // || ML.IO_GetXUp(xi.ETC_ResetSwR) || m_bBtnReset ; bool bAirSw = false; //ML.IO_GetXUp(xi.ETC_AirSw ) || m_bBtnAir ; bool bInitSw = false; //ML.IO_GetXUp(xi.ETC_InitSw ) ; bool bMotorSw = ML.IO_GetXUp(xi.ETC_MotorSw); if (m_bBtnStart) { Log.Trace("m_bBtnStart", "true"); } if (bStartSw) { Log.Trace("bStartSw", "Started"); if (m_iSeqStat == EN_SEQ_STAT.Init) { Log.Trace("SeqStat", "ssInit "); } if (m_iSeqStat == EN_SEQ_STAT.WorkEnd) { Log.Trace("SeqStat", "ssWorkEnd"); } if (m_iSeqStat == EN_SEQ_STAT.Error) { Log.Trace("SeqStat", "ssError "); } if (m_iSeqStat == EN_SEQ_STAT.Running) { Log.Trace("SeqStat", "ssRunning"); } if (m_iSeqStat == EN_SEQ_STAT.Stop) { Log.Trace("SeqStat", "ssStop "); } if (m_iSeqStat == EN_SEQ_STAT.RunWarn) { Log.Trace("SeqStat", "ssRunWarn"); } if (MM.GetManNo() != (int)mc.NoneCycle) { Log.Trace("ManCycle", string.Format(MM.GetManNo().ToString())); bStartSw = false; } } //Update Switch's Lamp bool bStopBtnFlick = (m_iStep == EN_SEQ_STEP.ToStopCon || m_iStep == EN_SEQ_STEP.ToStop) && m_bFlick; //버튼 클릭시나 ML.IO_SetY(yi.ETC_StartLp, ML.IO_GetX(xi.ETC_StartSw) || m_bRun); ML.IO_SetY(yi.ETC_StopLp, ML.IO_GetX(xi.ETC_StopSw) || !m_bRun || bStopBtnFlick); ML.IO_SetY(yi.ETC_ResetLp, ML.IO_GetX(xi.ETC_ResetSw) || (m_bFlick && isErr)); //ML.IO_SetY(yi.ETC_AirLp , ML.IO_GetX(xi.ETC_AirSw ) || ML.IO_GetY(yi.ETC_MainAirSol )); //ML.IO_SetY(yi.ETC_InitLp , ML.IO_GetX(xi.ETC_InitSw ) ); ML.IO_SetY(yi.ETC_MotorLp, ML.MT_GetServo(mi.OUT_TRelT)); //Center Man Button m_bBtnStart = false; m_bBtnStop = false; m_bBtnReset = false; m_bBtnAir = false; //Init. Button Flags. bool isHomeEnd = ML.MT_GetHomeDoneAll(); if (bStartSw) { if (!isHomeEnd) { Log.ShowMessage("Error", "장비 홈을 잡아주세요."); bStartSw = false; } //if(!LOT.GetLotOpen ()) { Log.ShowMessage("Error" , "장비 랏오픈을 해주세요."); bStartSw = false ; } //if(!InspectStripDispr ()) { m_bInspDispr = true ; bStartSw = false ; } //if(!InspectStripUnknown()) { m_bInspUnkwn = true ; bStartSw = false ; } if (m_iSeqStat == EN_SEQ_STAT.WorkEnd || m_iSeqStat == EN_SEQ_STAT.RunWarn) { Reset(); } } if (bInitSw) { MM.SetManCycle(mc.AllHome); } if (bMotorSw) { if (ML.MT_GetServo(mi.OUT_TRelT)) { ML.MT_SetServo(mi.OUT_TRelT, false); ML.MT_SetServo(mi.OUT_TRelB, false); } else { ML.MT_SetServo(mi.OUT_TRelT, true); ML.MT_SetServo(mi.OUT_TRelB, true); ML.MT_SetHomeDone(mi.OUT_TRelT, true); ML.MT_SetHomeDone(mi.OUT_TRelB, true); } } //Air Switch. //if(bAirSw && !m_bRun && m_iSeqStat != EN_SEQ_STAT.Init) //{ // ML.IO_SetY(yi.ETC_MainAirSol , !ML.IO_GetY(yi.ETC_MainAirSol )) ; //} //Buzzer Off. if (isErr && bStopSw) { ML.TL_SetBuzzOff(true); } bool isStopCon = bStopSw || (isErr && !m_bReqStop && m_bRun); bool isRunCon = bStartSw && !isErr; bool isResetCon = bResetSw && !m_bRun; //Run. if (isRunCon && (m_iStep == EN_SEQ_STEP.Idle)) { m_iStep = EN_SEQ_STEP.ToStartCon; ML.TL_SetBuzzOff(false); ML.ER_SetDisp(true); } if (isStopCon && (m_iStep != EN_SEQ_STEP.Idle)) //스타트버튼 안눌리는것 때문에 테스트. { m_bReqStop = true; } if (isResetCon && (m_iStep == EN_SEQ_STEP.Idle)) { Reset(); } if (m_tmToStrt.OnDelay(m_iStep == EN_SEQ_STEP.ToStartCon || m_iStep == EN_SEQ_STEP.ToStart, 10000)) { //Trace Log. string Msg; Msg = string.Format("ToStrtTimeOut : m_iStep=%d", m_iStep); Log.Trace("SEQ", Msg); ML.ER_SetErr(ei.ETC_ToStartTO); m_iStep = EN_SEQ_STEP.Idle; m_bRun = false; } //CDelayTimer StopBtn = null; //StopBtn = new CDelayTimer(); //if(m_iStep == EN_SEQ_STEP.scToStopCon) //{ // if(StopBtn.OnDelay(ML.IO_GetX((int)IP.xETC_StopSw)||ML.IO_GetX((int)IP.xETC_StopSw) , 5000)) // { // Log.Trace("SEQ","Forced Stop"); // m_bRun = false ; // m_iStep = EN_SEQ_STEP.scIdle; // m_bReqStop = false; // } //} //else //{ // StopBtn.Clear(); //} if (m_tmToStop.OnDelay(m_iStep == EN_SEQ_STEP.ToStopCon || m_iStep == EN_SEQ_STEP.ToStop, 10000)) // 20000)) { { //Trace Log. string Msg; Msg = string.Format("ToStopTimeOut : m_iStep=%d", m_iStep); Log.Trace("SEQ", Msg); m_bRun = false; ML.ER_SetErr(ei.ETC_ToStopTO); m_iStep = EN_SEQ_STEP.Idle; m_bReqStop = false; } EN_SEQ_STEP iPreStep = m_iStep; if (iPreStep != m_iStep) { string sMsg = ""; sMsg = "Step Changed" + string.Format(iPreStep.ToString()) + " -> " + string.Format(m_iStep.ToString()); Log.Trace("SEQ", sMsg); } iPreStep = m_iStep; //이상하게 중간에 랏엔드가 되는 현상 발견해서 넣어둠. bool bPreLotEnd = LOT.GetLotEnd(); if (LOT.GetLotEnd() != bPreLotEnd) { Log.Trace("SEQ", LOT.GetLotEnd() ? "LotEnd True" : "LotEnd False"); } bPreLotEnd = LOT.GetLotEnd(); //Running Step. switch (m_iStep) { case EN_SEQ_STEP.Idle: return; case EN_SEQ_STEP.ToStartCon: if (!ToStartCon()) { return; } m_iStep = EN_SEQ_STEP.ToStart; Log.Trace("SEQ", "scToStartCon END"); return; case EN_SEQ_STEP.ToStart: if (!ToStart()) { return; } m_bRun = true; m_bRunEdge = true; m_iStep = EN_SEQ_STEP.Run; Log.Trace("SEQ", "scToStart END"); return; case EN_SEQ_STEP.Run: if (!m_bReqStop) { if (Autorun()) { //랏엔드 상황. LOT.LotEnd(); Log.ShowMessage("Checked", "Lot Ended."); Log.Trace("SEQ", LOT.GetLotNo() + "LotEnd"); m_bRunEnd = true; m_iStep = EN_SEQ_STEP.ToStopCon; } return; } m_bReqStop = false; m_iStep = EN_SEQ_STEP.ToStopCon; Log.Trace("SEQ", "scRun END"); return; case EN_SEQ_STEP.ToStopCon: if (!ToStopCon()) { if (Autorun()) { //랏엔드 상황. LOT.LotEnd(); Log.Trace("SEQ", "scToStopCon LotEnd"); } return; } m_bRun = false; m_iStep = EN_SEQ_STEP.ToStop; Log.Trace("SEQ", "scToStopCon END"); return; case EN_SEQ_STEP.ToStop: if (!ToStop()) { return; } m_iStep = EN_SEQ_STEP.Idle; m_bReqStop = false; DM.SaveMap(); Log.Trace("SEQ", "scToStop END"); return; } }
private static void UpdateButton() { if (m_iStep != EN_SEQ_STEP.Idle) { InspectHomeDone(); if (!OM.CmnOptn.bIgnrDoor) { InspectDoor(); } } //Local Var. bool isErr = ML.ER_IsErr(); bool isHomeEnd = ML.MT_GetHomeDoneAll(); //vision manual button. //CDelayTimer tmVisnCycle ; //if(IO_GetX(xETC_LStopSw)&& m_iSeqStat == ssStop ){ //if(tmVisnCycle.OnDelay(true , 1000)) { // tmVisnCycle.Clear(); // if(MM.GetManNo() == mcNoneCycle) { // MM.SetManCycle(mcVSN_CycleWork); // } //} //} //else { //tmVisnCycle.Clear(); //} bool bStartSw = ML.IO_GetXUp(xi.ETC_LStartSw) || ML.IO_GetXUp(xi.ETC_RStartSw) || m_bBtnStart; // || ML.IO_GetXUp(xi.ETC_StartSwR) || m_bBtnStart ; bool bStopSw = ML.IO_GetXUp(xi.ETC_LStopSw) || ML.IO_GetXUp(xi.ETC_RStopSw) || m_bBtnStop; // || ML.IO_GetXUp(xi.ETC_StopSwR ) || m_bBtnStop ; bool bResetSw = ML.IO_GetXUp(xi.ETC_LResetSw) || ML.IO_GetXUp(xi.ETC_RResetSw) || m_bBtnReset; // || ML.IO_GetXUp(xi.ETC_ResetSwR) || m_bBtnReset ; bool bAirSw = ML.IO_GetXUp(xi.ETC_LAirSw) || ML.IO_GetXUp(xi.ETC_RAirSw) || m_bBtnAir; bool bInitSw = ML.IO_GetXUp(xi.ETC_LInitSw) || ML.IO_GetXUp(xi.ETC_RInitSw); bool bVisnSw = ML.IO_GetXUp(xi.ETC_LVisnSw) || ML.IO_GetXUp(xi.ETC_RVisnSw); if (m_bBtnStart) { Log.Trace("m_bBtnStart", "true"); } if (bStartSw) { Log.Trace("bStartSw", "Started"); if (MM.GetManNo() != (int)mc.NoneCycle) { Log.Trace("ManCycle", string.Format(MM.GetManNo().ToString())); bStartSw = false; } } //Update Switch's Lamp bool bStopBtnFlick = (m_iStep == EN_SEQ_STEP.ToStopCon || m_iStep == EN_SEQ_STEP.ToStop) && m_bFlick; //버튼 클릭시나 ML.IO_SetY(yi.ETC_LStartLp, ML.IO_GetX(xi.ETC_LStartSw) || m_bRun); ML.IO_SetY(yi.ETC_RStartLp, ML.IO_GetX(xi.ETC_RStartSw) || m_bRun); ML.IO_SetY(yi.ETC_LStopLp, ML.IO_GetX(xi.ETC_LStopSw) || !m_bRun || bStopBtnFlick); ML.IO_SetY(yi.ETC_RStopLp, ML.IO_GetX(xi.ETC_RStopSw) || !m_bRun || bStopBtnFlick); ML.IO_SetY(yi.ETC_LResetLp, ML.IO_GetX(xi.ETC_LResetSw) || (m_bFlick && isErr)); ML.IO_SetY(yi.ETC_RResetLp, ML.IO_GetX(xi.ETC_RResetSw) || (m_bFlick && isErr)); ML.IO_SetY(yi.ETC_LAirLp, ML.IO_GetX(xi.ETC_LAirSw) || ML.IO_GetY(yi.ETC_MainAirOnOff)); ML.IO_SetY(yi.ETC_RAirLp, ML.IO_GetX(xi.ETC_RAirSw) || ML.IO_GetY(yi.ETC_MainAirOnOff)); ML.IO_SetY(yi.ETC_LInitLp, ML.IO_GetX(xi.ETC_LInitSw)); ML.IO_SetY(yi.ETC_RInitLp, ML.IO_GetX(xi.ETC_RInitSw)); ML.IO_SetY(yi.ETC_LVisnLp, ML.IO_GetX(xi.ETC_LVisnSw)); ML.IO_SetY(yi.ETC_RVisnLp, ML.IO_GetX(xi.ETC_RVisnSw)); //Center Man Button m_bBtnStart = false; m_bBtnStop = false; m_bBtnReset = false; m_bBtnAir = false; //Init. Button Flags. if (bStartSw) { if (!isHomeEnd) { Log.ShowMessage("Error", "Machine Needed Initial"); bStartSw = false; } if (!LOT.GetLotOpen() && LOT.GetNextMgz() == "") { Log.ShowMessage("Error", "Machine Need to Lot "); bStartSw = false; } //기존 랏오픈 패턴 //if(LOT.GetNextMgz()=="") { Log.ShowMessage("Error" , "Machine Needed Lot List Registration" ); bStartSw = false ; } //기존 랏오픈 패턴 if (m_iSeqStat == EN_SEQ_STAT.WorkEnd || m_iSeqStat == EN_SEQ_STAT.RunWarn) { Reset(); } } if (bInitSw) { if (!ML.IO_GetY(yi.ETC_MainAirOnOff)) { ML.ER_SetErr(ei.ETC_MainAir, "Check Main Air"); return; } MM.SetManCycle(mc.AllHome); } //Vision버튼 추가. 진섭 if (bVisnSw) { if (!isHomeEnd) { Log.ShowMessage("Error", "Machine Needed Initial"); //ML.ER_SetErr(ei.MTR_HomeEnd, "Machine Needed Initial"); return; } if (m_iSeqStat == EN_SEQ_STAT.Running || m_iSeqStat == EN_SEQ_STAT.Manual) { Log.ShowMessage("Error", "Machine is not stopped."); //ML.ER_SetErr(ei.) return; } MM.SetManCycle(mc.VSNZ_Insp); } //Air Switch. if (bAirSw && !m_bRun && m_iSeqStat != EN_SEQ_STAT.Init) { ML.IO_SetY(yi.ETC_MainAirOnOff, !ML.IO_GetY(yi.ETC_MainAirOnOff)); } //Buzzer Off. if (isErr && bStopSw) { ML.TL_SetBuzzOff(true); } //Set Condition Flags. if (bStartSw) //스타트버튼 안눌리는것 때문에 테스트. { Log.Trace("isErr", isErr ? "true":"false"); Log.Trace("ManualMan.GetManNo()", string.Format(MM.GetManNo().ToString())); } if (bStopSw) { if (!_bRun && !MM.Working()) { ML.IO_SetY(yi.RAIL_FeedingAC1, false); ML.IO_SetY(yi.RAIL_FeedingAC2, false); ML.IO_SetY(yi.RAIL_FeedingAC3, false); } MM.Stop = true; Log.Trace("Stop", "Stop"); } bool isStopCon = bStopSw || (isErr && !m_bReqStop && m_bRun); bool isRunCon = bStartSw && !isErr /*&& ManualMan.GetManNo() == mcNone*/; bool isResetCon = bResetSw && !m_bRun; //Run. if (isRunCon && (m_iStep == EN_SEQ_STEP.Idle)) { m_iStep = EN_SEQ_STEP.ToStartCon; ML.TL_SetBuzzOff(false); ML.ER_SetDisp(true); } if (isRunCon && (m_iStep == EN_SEQ_STEP.Idle)) //스타트버튼 안눌리는것 때문에 테스트. { Log.Trace("isRunCon && m_iStep", string.Format(m_iStep.ToString())); } if (isStopCon && (m_iStep != EN_SEQ_STEP.Idle)) //스타트버튼 안눌리는것 때문에 테스트. { Log.Trace("isStopCon && m_iStep", string.Format(m_iStep.ToString())); Log.Trace("bStopSw", bStopSw ? "True" : "False"); Log.Trace("isErr", isErr ? "True" : "False"); Log.Trace("m_bReqStop", m_bReqStop ? "True" : "False"); Log.Trace("m_bRun", m_bRun ? "True" : "False"); m_bReqStop = true; } if (isResetCon && (m_iStep == EN_SEQ_STEP.Idle)) { Reset(); } if (m_tmToStrt.OnDelay(m_iStep == EN_SEQ_STEP.ToStartCon || m_iStep == EN_SEQ_STEP.ToStart, 10000)) { //Trace Log. string Msg; Msg = string.Format("ToStrtTimeOut : m_iStep=", m_iStep.ToString()); Log.Trace("SEQ", Msg); ML.ER_SetErr(ei.ETC_ToStartTO); m_iStep = EN_SEQ_STEP.Idle; m_bRun = false; } //CDelayTimer StopBtn = null; //StopBtn = new CDelayTimer(); //if(m_iStep == EN_SEQ_STEP.scToStopCon) //{ // if(StopBtn.OnDelay(ML.IO_GetX((int)IP.xETC_StopSw)||ML.IO_GetX((int)IP.xETC_StopSw) , 5000)) // { // Log.Trace("SEQ","Forced Stop"); // m_bRun = false ; // m_iStep = EN_SEQ_STEP.scIdle; // m_bReqStop = false; // } //} //else //{ // StopBtn.Clear(); //} bool bVisnInsp = VSNZ.GetSeqStep() == (int)VisnZone.sc.Insp; if (m_tmToStop.OnDelay((m_iStep == EN_SEQ_STEP.ToStopCon || m_iStep == EN_SEQ_STEP.ToStop) && !bVisnInsp, 10000)) { //Trace Log. string Msg; Msg = string.Format("ToStopTimeOut : m_iStep=", m_iStep.ToString()); Log.Trace("SEQ", Msg); m_bRun = false; ML.ER_SetErr(ei.ETC_ToStopTO); m_iStep = EN_SEQ_STEP.Idle; m_bReqStop = false; } EN_SEQ_STEP iPreStep = m_iStep; if (iPreStep != m_iStep) { string sMsg = ""; sMsg = "Step Changed" + string.Format(iPreStep.ToString()) + " -> " + string.Format(m_iStep.ToString()); Log.Trace("SEQ", sMsg); } iPreStep = m_iStep; //이상하게 중간에 랏엔드가 되는 현상 발견해서 넣어둠. bool bPreLotEnd = LOT.GetLotEnd(); if (LOT.GetLotEnd() != bPreLotEnd) { Log.Trace("SEQ", LOT.GetLotEnd() ? "LotEnd True" : "LotEnd False"); } bPreLotEnd = LOT.GetLotEnd(); //Running Step. switch (m_iStep) { case EN_SEQ_STEP.Idle: return; case EN_SEQ_STEP.ToStartCon: if (!ToStartCon()) { return; } m_iStep = EN_SEQ_STEP.ToStart; Log.Trace("SEQ", "scToStartCon END"); return; case EN_SEQ_STEP.ToStart: if (!ToStart()) { return; } m_bRun = true; m_bRunEdge = true; m_iStep = EN_SEQ_STEP.Run; Log.Trace("SEQ", "scToStart END"); return; case EN_SEQ_STEP.Run: if (!m_bReqStop) { if (Autorun()) { //랏엔드 상황. LOT.LotEnd(); Log.ShowMessage("Checked", "Lot Ended."); Log.Trace("SEQ", LOT.GetLotNo() + "LotEnd"); m_bRunEnd = true; m_iStep = EN_SEQ_STEP.ToStopCon; } return; } m_bReqStop = false; m_iStep = EN_SEQ_STEP.ToStopCon; Log.Trace("SEQ", "scRun END"); return; case EN_SEQ_STEP.ToStopCon: if (!ToStopCon()) { if (Autorun()) { //랏엔드 상황. LOT.LotEnd(); Log.Trace("SEQ", "scToStopCon LotEnd"); } return; } m_bRun = false; m_iStep = EN_SEQ_STEP.ToStop; Log.Trace("SEQ", "scToStopCon END"); return; case EN_SEQ_STEP.ToStop: if (!ToStop()) { return; } m_iStep = EN_SEQ_STEP.Idle; m_bReqStop = false; DM.SaveMap(); Log.Trace("SEQ", "scToStop END"); return; } }
private bool CycleReset() { if (tmTimeOut.OnDelay(iCycleStep != 0 && iCycleStep == iPreCycleStep, 2000)) { sErrMsg = string.Format(Para.Id.ToString() + " " + eSendingCmd.ToString() + " Cycle TimeOut iCycleStep={0:00}", iCycleStep); Log.Trace(sErrMsg); ML.IO_SetY(Para.yiReset, false); ML.ER_SetErr(ei.VSN_ComErr, sErrMsg); return(true); } if (iPreCycleStep != iCycleStep) { string sTemp = string.Format(Para.Id.ToString() + " " + eSendingCmd.ToString() + " Cycle iCycleStep={0:00}", iCycleStep); Log.Trace(sTemp); } iPreCycleStep = iCycleStep; switch (iCycleStep) { default: sErrMsg = string.Format(Para.Id.ToString() + " " + eSendingCmd.ToString() + " Cycle Default Clear at iCycleStep={0:00}", iCycleStep); Log.Trace(sErrMsg); ML.IO_SetY(Para.yiReset, false); ML.ER_SetErr(ei.VSN_ComErr, sErrMsg); return(true); case 10: iResetSendCnt = 0; ML.IO_SetY(Para.yiReset, false); ML.IO_SetY(Para.yiJobStart, false); ML.IO_SetY(Para.yiLotStart, false); iCycleStep++; return(false); //여기서 레디 안들어와 있으면. case 11: if (!ML.IO_GetX(Para.xiVisnReady)) { ML.IO_SetY(Para.yiReset, true); tmDelay.Clear(); iCycleStep++; return(false); } iCycleStep = 14; return(false); //레디 안들어왔으면 리셑을 켜서 레디를 먼저 한다. case 12: if (!tmDelay.OnDelay(50)) { return(false); } //if(!ML.IO_GetX(Para.xiVisnReady)) return false ; ML.IO_SetY(Para.yiReset, false); iCycleStep++; return(false); case 13: //if(!tmDelay.OnDelay(500)) return false ; iCycleStep++; return(false); //여기부터 세팅. //밑에서 씀. case 14: ML.IO_SetY(Para.yiReset, true); iCycleStep++; return(false); case 15: if (ML.IO_GetX(Para.xiVisnReady)) { return(false); //이게 맞는건가??? } ML.IO_SetY(Para.yiReset, false); iCycleStep++; return(false); case 16: if (!ML.IO_GetX(Para.xiVisnReady)) { return(false); } tmDelay.Clear(); iCycleStep++; return(false); case 17: if (!tmDelay.OnDelay(100)) { return(false); } iResetSendCnt++; if (iResetSendCnt == 1) { //if(!ML.IO_GetX(Para.xiVisnBusy)) //{ iCycleStep = 14; return(false); //} } if (iResetSendCnt > 1) { if (ML.IO_GetX(Para.xiVisnBusy)) { sErrMsg = "Vision Reset Failed!"; return(true); } } return(true); } }