//------------------------------------------------------------------------------------------------- public void fn_GetAlarm() { m_bIsAlarmUnitLeakDown = _ReadData[(int)EN_ATSUPPLY_READ_AREA._049_UNIT_LEAK_DOWN] == 1 ? true : false; m_bIsAlarmUnitLeakRoomBottom = _ReadData[(int)EN_ATSUPPLY_READ_AREA._056_UNIT_LEAK__ROOM_BOTTOM] == 1 ? true : false; m_bIsAlarmUnitLeakTankRoom = _ReadData[(int)EN_ATSUPPLY_READ_AREA._057_UNIT_LEAK__TANK_ROOM] == 1 ? true : false; m_bIsAlarmUnitLeakLeakBox = _ReadData[(int)EN_ATSUPPLY_READ_AREA._058_UNIT_LEAK__VALVE_BOX] == 1 ? true : false; m_bIsAlarmUnitLeakValveBox = _ReadData[(int)EN_ATSUPPLY_READ_AREA._059_UNIT_LEAK__LEAK_BOX_] == 1 ? true : false; m_bIsAlarmPropellerRotation = _ReadData[(int)EN_ATSUPPLY_READ_AREA._066_SUP_TK_A_ERROR] == 1 ? true : false; m_bIsAlarmSlurryTankLevelHigh = _ReadData[(int)EN_ATSUPPLY_READ_AREA._068_SUP_TK_A_LEVEL_HH] == 1 ? true : false; m_bIsAlarmSlurryTankLevelLow = _ReadData[(int)EN_ATSUPPLY_READ_AREA._069_SUP_TK_A_LEVEL_L_OFF] == 1 ? true : false; m_bIsAlarmSlurryTankLevelEmpty = _ReadData[(int)EN_ATSUPPLY_READ_AREA._070_SUP_TK_A_LEVEL_EMPTY] == 1 ? true : false; m_bIsAlarmSupplyFluxHigh = _ReadData[(int)EN_ATSUPPLY_READ_AREA._071_SUPPLY__FLUX_HIGH] == 1 ? true : false; m_bIsAlarmSupplyFluxLow = _ReadData[(int)EN_ATSUPPLY_READ_AREA._072_SUPPLY__FLUX_LOW] == 1 ? true : false; m_bIsAlarmReturnFluxHigh = _ReadData[(int)EN_ATSUPPLY_READ_AREA._073_RETURN__FLUX_HIGH] == 1 ? true : false; m_bIsAlarmReturnFluxLow = _ReadData[(int)EN_ATSUPPLY_READ_AREA._074_RETURN__FLUX_LOW] == 1 ? true : false; m_bIsAlarmReturnPressureHigh = _ReadData[(int)EN_ATSUPPLY_READ_AREA._075_RETURN__PRESSURE_HIGH] == 1 ? true : false; m_bIsAlarmReturnPressureLow = _ReadData[(int)EN_ATSUPPLY_READ_AREA._076_RETURN__PRESSURE_LOW] == 1 ? true : false; m_bIsAlarmSupplyRequest = _ReadData[(int)EN_ATSUPPLY_READ_AREA._112_SUP_TK_A_CHARGE_REQUEST] == 1 ? true : false; //Alarm Set if (m_nType == SPLY_SLURRY) { EPU.fn_SetErr(EN_ERR_LIST.ERR_0400, m_bIsAlarmUnitLeakDown); EPU.fn_SetErr(EN_ERR_LIST.ERR_0401, m_bIsAlarmUnitLeakRoomBottom); EPU.fn_SetErr(EN_ERR_LIST.ERR_0402, m_bIsAlarmUnitLeakTankRoom); EPU.fn_SetErr(EN_ERR_LIST.ERR_0403, m_bIsAlarmUnitLeakLeakBox); EPU.fn_SetErr(EN_ERR_LIST.ERR_0404, m_bIsAlarmUnitLeakValveBox); EPU.fn_SetErr(EN_ERR_LIST.ERR_0405, m_bIsAlarmPropellerRotation); EPU.fn_SetErr(EN_ERR_LIST.ERR_0406, m_bIsAlarmSlurryTankLevelHigh); EPU.fn_SetErr(EN_ERR_LIST.ERR_0407, m_bIsAlarmSlurryTankLevelLow); EPU.fn_SetErr(EN_ERR_LIST.ERR_0408, m_bIsAlarmSlurryTankLevelEmpty); EPU.fn_SetErr(EN_ERR_LIST.ERR_0409, m_bIsAlarmSupplyFluxHigh); EPU.fn_SetErr(EN_ERR_LIST.ERR_0410, m_bIsAlarmSupplyFluxLow); EPU.fn_SetErr(EN_ERR_LIST.ERR_0411, m_bIsAlarmReturnFluxHigh); EPU.fn_SetErr(EN_ERR_LIST.ERR_0412, m_bIsAlarmReturnFluxLow); EPU.fn_SetErr(EN_ERR_LIST.ERR_0413, m_bIsAlarmReturnPressureHigh); EPU.fn_SetErr(EN_ERR_LIST.ERR_0414, m_bIsAlarmReturnPressureLow); EPU.fn_SetErr(EN_ERR_LIST.ERR_0415, m_bIsAlarmSupplyRequest); } else { EPU.fn_SetErr(EN_ERR_LIST.ERR_0420, m_bIsAlarmUnitLeakDown); EPU.fn_SetErr(EN_ERR_LIST.ERR_0421, m_bIsAlarmUnitLeakRoomBottom); EPU.fn_SetErr(EN_ERR_LIST.ERR_0422, m_bIsAlarmUnitLeakTankRoom); EPU.fn_SetErr(EN_ERR_LIST.ERR_0423, m_bIsAlarmUnitLeakLeakBox); EPU.fn_SetErr(EN_ERR_LIST.ERR_0424, m_bIsAlarmUnitLeakValveBox); EPU.fn_SetErr(EN_ERR_LIST.ERR_0425, m_bIsAlarmPropellerRotation); EPU.fn_SetErr(EN_ERR_LIST.ERR_0426, m_bIsAlarmSlurryTankLevelHigh); EPU.fn_SetErr(EN_ERR_LIST.ERR_0427, m_bIsAlarmSlurryTankLevelLow); EPU.fn_SetErr(EN_ERR_LIST.ERR_0428, m_bIsAlarmSlurryTankLevelEmpty); EPU.fn_SetErr(EN_ERR_LIST.ERR_0429, m_bIsAlarmSupplyFluxHigh); EPU.fn_SetErr(EN_ERR_LIST.ERR_0430, m_bIsAlarmSupplyFluxLow); EPU.fn_SetErr(EN_ERR_LIST.ERR_0431, m_bIsAlarmReturnFluxHigh); EPU.fn_SetErr(EN_ERR_LIST.ERR_0432, m_bIsAlarmReturnFluxLow); EPU.fn_SetErr(EN_ERR_LIST.ERR_0433, m_bIsAlarmReturnPressureHigh); EPU.fn_SetErr(EN_ERR_LIST.ERR_0434, m_bIsAlarmReturnPressureLow); EPU.fn_SetErr(EN_ERR_LIST.ERR_0435, m_bIsAlarmSupplyRequest); } }
//--------------------------------------------------------------------------- private void menuSave_Click(object sender, RoutedEventArgs e) { //Run Check if (SEQ._bAuto || SEQ._bRun) { return; } //Save switch ((EN_PAGE)m_nNowPage) { case EN_PAGE.IO: IO.fn_LoadIO(false); fn_WriteLog("[Setting Save] IO"); break; case EN_PAGE.OPTION: mc_Option.fn_DisplayOptionData(false); fn_WriteLog("[Setting Save] OPTION"); break; case EN_PAGE.VISION: fn_WriteLog("[Setting Save] VISION"); break; case EN_PAGE.ERROR: EPU.fn_LoadErrorData(false); fn_WriteLog("[Setting Save] ERROR"); break; case EN_PAGE.MOTOR: mc_Motor.fn_GridToBuff(); MOTR.Load(false, FM._sCurrJob); FM.fn_LoadMastOptn(false); //JUNG/200723 fn_WriteLog("[Setting Save] MOTOR"); break; case EN_PAGE.LAMP: mc_Lamp.fn_GridToBuff(); LAMP.fn_Load(false); fn_WriteLog("[Setting Save] LAMP"); break; case EN_PAGE.ACTUATOR: mc_Actr.fn_GridToBuff(); ACTR.fn_Load(false); fn_WriteLog("[Setting Save] ACTUATOR"); break; default: break; } }
//--------------------------------------------------------------------------- private void Page_Loaded(object sender, RoutedEventArgs e) { //List Set EPU.m_fn_SetList(lbAlarm, lbWarn); fn_SetTimer(true); // fn_MapGridSet(ref gdStorage, ref lbStorg, (int)EN_STOR_ID.POLISH); fn_MapGridSet(ref gdStorage1, ref lbStorg1, (int)EN_STOR_ID.CLEAN); // fn_MapGridSet_MAGA(ref Magz01, ref lbMagz01, (int)EN_MAGA_ID.MAGA01); fn_MapGridSet_MAGA(ref Magz02, ref lbMagz02, (int)EN_MAGA_ID.MAGA02); }
//--------------------------------------------------------------------------- //Update Timer private void fn_tmUpdate(object sender, EventArgs e) { //m_UpdateTimer.Stop(); // switch (m_nStep) { case 0: tbLoadMsg.Text = " Now Loading System Data..."; if (!m_tDelayTimer.OnDelay(true, 300)) { return; } m_tDelayTimer.Clear(); m_nStep++; break; case 1: //Load Default file Info. tbLoadMsg.Text = " Loading the Information..."; FM.fn_LoadLastInfo(true); tbLoadMsg.Text = " Loading the Project Info..."; FM.fn_LoadProject(true, FM._sCurrJob); tbLoadMsg.Text = " Loading the System Option..."; FM.fn_LoadSysOptn(true); tbLoadMsg.Text = " Loading the Master Option..."; FM.fn_LoadMastOptn(true); tbLoadMsg.Text = " Loading the Recipe Data..."; FM.fn_LoadRecipeInfo(true, FM._sRecipeName); tbLoadMsg.Text = " Loading the Password..."; FM.fn_LoadPassWord(true); tbLoadMsg.Text = " Loading SPC Data..."; SPC.Load(true); m_tDelayTimer.Clear(); m_nStep++; break; case 2: if (!m_tDelayTimer.OnDelay(true, 100)) { return; } tbLoadMsg.Text = " Loading the IO List..."; IO.fn_LoadIO(true); tbLoadMsg.Text = " Loading the Lamp/Buzzer Data..."; LAMP.fn_Load(true); tbLoadMsg.Text = " Loading the Actuator Data..."; ACTR.fn_Load(true); //tbLoadMsg.Text = " ACS IO Connection...(SIM)" ; IO.fn_ACSConnect(UserConst.ACS_CON_SIM); tbLoadMsg.Text = " ACS IO Connection..."; IO.fn_ACSConnect(UserConst.ACS_CON_NOR); m_tDelayTimer.Clear(); m_nStep++; break; case 3: //if (!m_tDelayTimer.OnDelay(true, 100)) return; tbLoadMsg.Text = " Loading the Error List..."; EPU.fn_LoadErrorData(true); tbLoadMsg.Text = " Loading the Lamp/Buzzer Data..."; EPU.fn_LoadLampData(true); m_tDelayTimer.Clear(); m_nStep++; break; case 4: if (!m_tDelayTimer.OnDelay(true, 500)) { return; } //tbLoadMsg.Text = " Loading the Motor List...(SIM)"; MOTR.fn_InitMotor(UserConst.ACS_CON_SIM); tbLoadMsg.Text = " Loading the Motor List..."; MOTR.fn_InitMotor(UserConst.ACS_CON_NOR); tbLoadMsg.Text = " Loading the Vision Recipe..."; g_VisionManager.fn_LoadVision(FM._sRecipeName); //tbLoadMsg.Text = " Loading the Motor Data..." ; FM.fn_LoadMastOptn(true); //tbLoadMsg.Text = " Loading the Motor DSTB..." ; MOTR.fn_LoadMotrDisturb(true); m_tDelayTimer.Clear(); m_nStep++; break; case 5: //if (!m_tDelayTimer.OnDelay(true, 500)) return; tbLoadMsg.Text = " Loading the Data Manager Map Data..."; DM.fn_LoadMap(true); tbLoadMsg.Text = " Loading the Sequence Data..."; SEQ.fn_LoadWorkInfo(true); m_tDelayTimer.Clear(); m_nStep++; break; case 6: //Row, Col Setting... tbLoadMsg.Text = " Apply Project..."; FM.ApplyProject(FM._sCurrJob); m_nStep++; break; case 7: //LoadCell tbLoadMsg.Text = " Initial Load Cell ..."; LDCBTM.fn_SetParam(); LDCBTM.fn_Open(LDCBTM._sSerialNo); //LDCBTM.fn_Open (FM.m_stMasterOpt.sLoadCellSN); LDCBTM.fn_Close(); //JUNG/201014/Retry LDCBTM.fn_Open(LDCBTM._sSerialNo); //PMC, Slurry Init //tbLoadMsg.Text = " Initial PMC IP,Port ..." ; PMC.fn_SetIpAddress(FM.m_stSystemOpt.sPMCIp, FM.m_stSystemOpt.nPMCPort); tbLoadMsg.Text = " Initial REST API ..."; REST.fn_SetURL(FM.m_stSystemOpt.sRestApiUrl); tbLoadMsg.Text = " Initial RFID Reader ..."; m_nStep++; break; case 8: if (IO._bConnect) { //RFID tbLoadMsg.Text = " Initial RFID Reader ..."; RFID.fn_Connect(); } m_nStep++; break; case 9: //if (!m_tDelayTimer.OnDelay(true, 500)) return; //Main Load fn_MainFormLoad(); m_UpdateTimer.Stop(); m_nStep++; break; default: break; } //Step Inc. pbStep.Value = m_nStep * 10; //m_UpdateTimer.Start(); }
//--------------------------------------------------------------------------- public void fn_Update(EN_SEQ_STATE iSeqStat) { //if(SEQ._bRun) return; bool bLotOpen = LOT._bLotOpen; bool bDoorOpen = SEQ.fn_IsAnyDoorOpen(true); //Set Start. m_dSeqSrtTime = TICK._GetTickTime(); //Get During Seq Time. m_dDrngSeqTime = m_dSeqSrtTime - m_dSeqEndTime; EN_ERR_KIND iLastErrKind = (EN_ERR_KIND)EPU.fn_GetKind(EPU._nLastErr); //Clear. //86400000 == 24:00:00 //Day Sequence 별 시간 증가. //dPMTime : PM Time / dDownTime : 비가동 / dRunTime : 가동 switch (iSeqStat) { case EN_SEQ_STATE.RUNNING: case EN_SEQ_STATE.RUNWARN: DAILY_DATA.dRunTime += m_dDrngSeqTime; DAILY_DATA.dTotalTime += m_dDrngSeqTime; break; case EN_SEQ_STATE.INIT: case EN_SEQ_STATE.WARNING: case EN_SEQ_STATE.STOP: case EN_SEQ_STATE.IDLE: if (bLotOpen) { DAILY_DATA.dPMTime += m_dDrngSeqTime; } else { if (bDoorOpen) { DAILY_DATA.dPMTime += m_dDrngSeqTime; } else { DAILY_DATA.dDownTime += m_dDrngSeqTime; } } DAILY_DATA.dTotalTime += m_dDrngSeqTime; break; case EN_SEQ_STATE.ERROR: if (bLotOpen) { DAILY_DATA.dPMTime += m_dDrngSeqTime; } else { if (bDoorOpen) { DAILY_DATA.dPMTime += m_dDrngSeqTime; } else { DAILY_DATA.dDownTime += m_dDrngSeqTime; } } DAILY_DATA.dErrorTime += m_dDrngSeqTime; DAILY_DATA.dTotalTime += m_dDrngSeqTime; break; default: if (bLotOpen) { DAILY_DATA.dPMTime += m_dDrngSeqTime; } else { if (bDoorOpen) { DAILY_DATA.dPMTime += m_dDrngSeqTime; } else { DAILY_DATA.dDownTime += m_dDrngSeqTime; } } DAILY_DATA.dTotalTime += m_dDrngSeqTime; break; } // //DAILY_DATA.dTotalTime += m_dDrngSeqTime; //Set End Time. m_dSeqEndTime = TICK._GetTickTime(); //Check Changing Time. if (!IsChangedDay()) { return; } string sLog = string.Empty; //string sLog = string.Format($"Day Change : MTBI= {CalMTBI(DAILY_DATA.dRunTime, DAILY_DATA.iJamQty)})"); //fn_WriteLog(sLog); sLog = string.Format($"TOTAL TIME : {TICK.ConvTimeTickToStr(SPC.DAILY_DATA.dTotalTime)} / RUN TIME : {TICK.ConvTimeTickToStr(SPC.DAILY_DATA.dRunTime)} / DOWN TIME : {TICK.ConvTimeTickToStr(SPC.DAILY_DATA.dDownTime)} / PM TIME : {TICK.ConvTimeTickToStr(SPC.DAILY_DATA.dPMTime)}"); fn_WriteLog(sLog); //Kill Past Log LOG.fn_DeleteOldFile(); SPC_EFF.ResetData(); DAILY_DATA.ResetData(); }
//--------------------------------------------------------------------------- private void fn_DisplayErr() { //Var. string sTemp = string.Empty; int nErrNo = EPU.fn_GetLastErrNo(false); tbSubAlarm.Visibility = Visibility.Hidden; //Check if (nErrNo < 0 || nErrNo > MAX_ERROR) { return; } lbErrNo.Content = string.Format($"{nErrNo+1:D4}"); lbErrName.Content = EPU.ERR[nErrNo]._sName; lbErrCause.Content = EPU.ERR[nErrNo]._sCause; //lbErrSolution.Content = EPU.ERR[nErrNo]._sSolution ; //JUNG/210126 sTemp = EPU.ERR[nErrNo]._sSolution; sTemp = sTemp.Replace('$', '\r'); //sTemp.Replace('\r', '$'); sTemp = sTemp.Replace('^', '\n'); //sTemp.Replace('\n', '#'); lbErrSolution.Content = sTemp; //List Setting lbErrList.Items.Clear(); for (int i = 0; i < MAX_ERROR; i++) { if (i == nErrNo) { continue; } if (EPU.ERR[i]._bOn && EPU.ERR[i]._nGrade == (int)EN_ERR_GRADE.egError) { sTemp = string.Format($"[ERR_{i+1:D4}] "); sTemp += EPU.ERR[i]._sName; lbErrList.Items.Insert(0, sTemp); } } //Check Sub Alarm if (m_nSelSubPart > 0) { tbSubAlarm.SelectedIndex = m_nSelSubPart; tbSubAlarm.Visibility = Visibility.Visible; btReset.IsEnabled = false; btClose.IsEnabled = false; } else { btReset.IsEnabled = true; btClose.IsEnabled = true; } // m_UpdateTimer.IsEnabled = true; }
//------------------------------------------------------------------------------------------------- private void fn_Update() { switch (m_nStep) { case 0: if (m_bSend) { m_bSend = false; m_nStep = 5; return; } m_nStep++; return; //------------------------------------------------------------------------------------------------- // Read Seq case 1: //if (!m_tSendDelayTimer.fnTimeOut(200)) return; //Read plc.fn_ReadArea(MemoryArea.EM, (ushort)SUPPLY_START_ADD, 0, 512); // Request State Check fn_IsRequest(); // Get Status Data fn_GetStatusData(); // Alarm Check //fn_GetAlarm(); //-->> 차후 적용 필요 m_bSend = true; m_nStep = 0; return; //------------------------------------------------------------------------------------------------- // Send Seq case 5: if (!fn_CheckEquipID()) { //Alarm EPU.fn_SetErr(EN_ERR_LIST.ERR_0452 + m_nType); //JUNG/200811 m_nStep = 0; return; } //Write fn_ConvertBooltoByte(); plc.fn_SendArea((ushort)SUPPLY_START_ADD, m_temp); //All Write m_nStep = 0; return; default: m_nStep = 0; return; } }
//--------------------------------------------------------------------------- //Update Timer private void fn_tmUpdate(object sender, EventArgs e) { // //m_UpdateTimer.Stop(); m_UpdateTimer.IsEnabled = false; //Error Check EPU.fn_ErrorDisplay(); //Run Status fn_SetLabelColor(ref lbRun, SEQ._bRun, Brushes.Green, Brushes.DarkGray); fn_SetLabelText(ref lbRun, SEQ._bRun, "RUN", "STOP", Brushes.Black, Brushes.Chocolate); // bool a = SEQ._bRun && SEQ_CLEAN._bDrngCleaning && SEQ_CLEAN._bDrngRotateHome; bool b = (MOTR.IsAllHomeEnd() && MOTR.IsAllServoOn()) || a; //fn_SetLabelColor(ref btAllHome, MOTOR.IsAllHome(), Brushes.Lime, Brushes.LightGray); fn_SetLabel(ref lbAllHome, b? "ALL HOME" : "NEED INIT...", b ? Brushes.White : Brushes.Brown, b ? Brushes.Black : SEQ._bFlick1? Brushes.Aqua : Brushes.Yellow); fn_SetLabelColor(ref lbAuto, SEQ._bAuto, Brushes.Green, Brushes.DarkBlue); lbAuto.Content = SEQ._bAuto ? "AUTO" : "MANUAL"; lbAuto.Foreground = SEQ._bAuto ? Brushes.Black : Brushes.LightYellow; // btDoor_O.IsEnabled = !SEQ._bRun; btDoor_C.IsEnabled = !SEQ._bRun; lbAllHome.IsEnabled = !SEQ._bRun; lbAuto.IsEnabled = !SEQ._bRun; //btSDoor_O.IsEnabled = !SEQ._bRun; //btSDoor_C.IsEnabled = !SEQ._bRun; //btReset.Background = EPU.fn_GetHasErr()? Brushes.Green : SEQ._bFlick1 ? Brushes.Gray : Brushes.Yellow; //btDoor_O.Background = (!IO.XV[(int)EN_INPUT_ID.xSYS_DR_Right_KeyIn] || !IO.XV[(int)EN_INPUT_ID.xSYS_DR_Left_KeyIn]) ? Brushes.MintCream : Brushes.MintCream; //btDoor_C.Background = ( IO.XV[(int)EN_INPUT_ID.xSYS_DR_Right_KeyIn ] && IO.XV[(int)EN_INPUT_ID.xSYS_DR_Left_KeyIn]) ? Brushes.MintCream : Brushes.MintCream; bool bDoorOutput = IO.YV[(int)EN_OUTPUT_ID.ySYS_Door_FrontLeft] || IO.YV[(int)EN_OUTPUT_ID.ySYS_Door_FrontRight] || IO.YV[(int)EN_OUTPUT_ID.ySYS_Door_Side]; bool bDoorKeyIn = IO.XV[(int)EN_INPUT_ID.xSYS_DR_Right_KeyIn] && IO.XV[(int)EN_INPUT_ID.xSYS_DR_Left_KeyIn] && IO.XV[(int)EN_INPUT_ID.xSYS_DR_SideDoor_KeyIn]; bool bDoorActrOk = IO.XV[(int)EN_INPUT_ID.xSYS_DR_MainClose_R] && IO.XV[(int)EN_INPUT_ID.xSYS_DR_MainClose_L] && IO.XV[(int)EN_INPUT_ID.xSYS_DR_SideDoorClose]; btDoor_O.Background = (!bDoorOutput && bDoorKeyIn && bDoorActrOk) ? G_COLOR_BTNNORMAL : Brushes.Lime; //JUNG/200525/삭제 //bool bDoorY = IO.YV[(int)EN_OUTPUT_ID.ySYS_Door_FrontLeft] == true || IO.YV[(int)EN_OUTPUT_ID.ySYS_Door_FrontRight] == true || // IO.YV[(int)EN_OUTPUT_ID.ySYS_Door_Side ] == true; //btDoor_O .Background = bDoorY ? Brushes.Gray : Brushes.WhiteSmoke; //btSDoor_O.Background = ( IO.YV[(int)EN_OUTPUT_ID.ySYS_Door_Side ] == true) ? Brushes.Gray : Brushes.WhiteSmoke; // btLight.Background = IO.YV[(int)EN_OUTPUT_ID.ySYS_Light]? Brushes.Lime : new SolidColorBrush(Color.FromArgb(0xFF, 0xF7, 0xF7, 0xF7)); // m_UpdateTimer.IsEnabled = true; }