Exemple #1
0
        // Internal Methods -------------------------------------------------------------
        protected override void InitializeStateMachine()
        {
            base.InitializeStateMachine();
            TransitionTo(stateMonitoring);

            #region Error messages.
            ButtonList lst = new ButtonList(ErrorButton.NoButton, ErrorButton.OK, ErrorButton.NoButton);
            string     src = "HST.Monitor";


            mainDoorIsNotLocked = new MonitorErrorMessage(_workcell, true, src, lst);
            mainDoorIsNotLocked.Format(HSTErrors.DoorNotLockError.ToString());
            mainDoorIsNotLocked.Priority         = 1;
            mainDoorIsNotLocked.TriggerError     = false;
            mainDoorIsNotLocked.IsAutoClearError = true;
            mainDoorIsNotLocked.Source           = ((int)HSTErrors.DoorNotLockError).ToString("000000");
            mainDoorIsNotLocked.SetWorkInstruction("Work instruction for door not lock Error is TBD");

            groundMasterError = new MonitorErrorMessage(_workcell, true, src, lst);
            groundMasterError.Format(HSTErrors.GroundMasterError.ToString());
            groundMasterError.Priority         = 14;
            groundMasterError.DigitalInput     = ioManifest.GetDigitalInput((int)HSTIOManifest.DigitalInputs.Ground_Master);
            groundMasterError.WorkingState     = DigitalIOState.Off;
            groundMasterError.IsAutoClearError = false;
            groundMasterError.Source           = ((int)HSTErrors.GroundMasterError).ToString("000000");
            groundMasterError.SetWorkInstruction("Work instruction for ground Master Error is TBD");

            emoTriggered = new MonitorErrorMessage(_workcell, true, src, lst);
            emoTriggered.Format(HSTErrors.EMOTriggeredError.ToString());
            emoTriggered.Priority         = 8;
            emoTriggered.TriggerError     = false;
            emoTriggered.IsAutoClearError = false;
            emoTriggered.Source           = ((int)HSTErrors.EMOTriggeredError).ToString("000000");
            emoTriggered.SetWorkInstruction("Work instruction for EMO tiggered error is TBD");

            safetyControllerPresentError = new MonitorErrorMessage(_workcell, true, src, lst);
            safetyControllerPresentError.Format(HSTErrors.SafetyControllerPresentError.ToString());
            safetyControllerPresentError.Priority         = 15;
            safetyControllerPresentError.TriggerError     = false;
            safetyControllerPresentError.IsAutoClearError = false;
            safetyControllerPresentError.Source           = ((int)HSTErrors.SafetyControllerPresentError).ToString("000000");
            safetyControllerPresentError.SetWorkInstruction("Work instruction for Safety Controller Present Error is TBD");

            ticTriggeringError = new MonitorErrorMessage(_workcell, true, src, lst);
            ticTriggeringError.Format(HSTErrors.TICTriggeringError.ToString());
            ticTriggeringError.Priority         = 15;
            ticTriggeringError.TriggerError     = false;
            ticTriggeringError.IsAutoClearError = false;
            ticTriggeringError.Source           = ((int)HSTErrors.TICTriggeringError).ToString("000000");

            performanceTriggeringError = new MonitorErrorMessage(_workcell, true, src, lst);
            performanceTriggeringError.Format(HSTErrors.PerformanceTriggeringError.ToString());
            performanceTriggeringError.Priority         = 1;
            performanceTriggeringError.TriggerError     = false;
            performanceTriggeringError.IsAutoClearError = false;
            performanceTriggeringError.Source           = ((int)HSTErrors.PerformanceTriggeringError).ToString("000000");
            performanceTriggeringError.SetWorkInstruction("Please call technician to check tesing performance because running result hit triggering limitation percentage.");

            probeFunctionalTestTriggeringError = new MonitorErrorMessage(_workcell, true, src, lst);
            probeFunctionalTestTriggeringError.Format(HSTErrors.ProbeFunctionalTestTriggeringError.ToString());
            probeFunctionalTestTriggeringError.Priority         = 1;
            probeFunctionalTestTriggeringError.TriggerError     = false;
            probeFunctionalTestTriggeringError.IsAutoClearError = false;
            probeFunctionalTestTriggeringError.Source           = ((int)HSTErrors.ProbeFunctionalTestTriggeringError).ToString("000000");
            probeFunctionalTestTriggeringError.SetWorkInstruction("Please call technician to check resistance measurement board because known resistance reading was failed.");

            samplingOverLimitTriggeringError = new MonitorErrorMessage(_workcell, true, src, lst);
            samplingOverLimitTriggeringError.Format(HSTErrors.ErrorCodeTriggeringError.ToString());
            samplingOverLimitTriggeringError.Priority         = 1;
            samplingOverLimitTriggeringError.TriggerError     = false;
            samplingOverLimitTriggeringError.IsAutoClearError = false;
            samplingOverLimitTriggeringError.Source           = ((int)HSTErrors.SamplingTriggeringError).ToString("000000");
            samplingOverLimitTriggeringError.SetWorkInstruction("Part status {A} for on disk sampling over target, Please call technician to verify!");

            cccMachineTriggeringError = new MonitorErrorMessage(_workcell, true, src, lst);
            cccMachineTriggeringError.Format(HSTErrors.ANCTriggeringError.ToString());
            cccMachineTriggeringError.Priority         = 1;
            cccMachineTriggeringError.TriggerError     = false;
            cccMachineTriggeringError.IsAutoClearError = false;
            cccMachineTriggeringError.Source           = ((int)HSTErrors.ANCTriggeringError).ToString("000000");
            cccMachineTriggeringError.SetWorkInstruction("ANC Triggering");

            motionError = new MonitorErrorMessage(_workcell, true, src, lst);
            motionError.Format(HSTErrors.MotionAxitError.ToString());
            motionError.Priority         = 1;
            motionError.TriggerError     = false;
            motionError.IsAutoClearError = false;
            motionError.Source           = ((int)HSTErrors.MotionAxitError).ToString("000000");
            motionError.SetWorkInstruction("Aerotech motion error");


            #endregion

            // WARNING MEESSAGE
            #region Warnning messages
            mainDoorIsNotLocked.TriggerError     = false;
            mainDoorIsNotLocked.IsAutoClearError = false;
            mainDoorIsNotLocked.Source           = ((int)HSTErrors.DoorNotLockError).ToString("000000");
            mainDoorIsNotLocked.SetWorkInstruction("Work instruction for door not lock Error is TBD");

            conveyorCongestion = new MonitorErrorMessage(_workcell, false, src, lst);
            conveyorCongestion.Format(HSTErrors.OutputConveyorCongestionError.ToString());
            conveyorCongestion.Priority         = 2;
            conveyorCongestion.TriggerError     = false;
            conveyorCongestion.IsAutoClearError = false;
            conveyorCongestion.SetWorkInstruction("Work instruction for Conveyor Congestion is TBD");

            #endregion
        }
Exemple #2
0
        protected QState Monitoring(IQEvent qEvent)
        {
            var groundMonitorStatusWorking = true;

            //LogMessage("Monitoring", qEvent);
            if (qEvent.IsSignal(SigStateJob))
            {
                if (HSTWorkcell.terminatingHSTApps)
                {
                    return(null);
                }

                //Show alert message grounding
                try
                {
                    groundMonitorStatusWorking       = Controller.isGroundMasterWorking();
                    _workcell.GroundMonitoringStatus = groundMonitorStatusWorking;
                }
                catch (Exception)
                {
                }

                if (!groundMonitorStatusWorking)
                {
                    _workcell.SendGroundMasterStatusMessage();
                    groundMasterError.PostErrorMessage();

                    if (!_workcell.GroundMonitoringErrActivated)
                    {
                        _workcell.GroundMonitoringErrActivated = true;
                    }
                }
                else
                {
                    groundMasterError.ClearErrorMessage();
                    _workcell.SendGroundMasterStatusMessage();
                }

                if (Controller.IsCriticalTriggeringActivated && !_workcell.LoadCounter.CarrierTriggeringData.BuyoffProcessStarted)
                {
                    _workcell.SendMachinePerformanceStatusMessage();
                    performanceTriggeringError.PostErrorMessage();
                }
                else
                {
                    _workcell.SendMachinePerformanceStatusMessage();
                    performanceTriggeringError.ClearErrorMessage();
                }

                if (HSTMachine.Workcell.HSTSettings.ResistanceCheckingConfig.ResistanceCriticalActivated && !HSTMachine.Workcell.OffAlertMessage)
                {
                    _workcell.SendFunctionalTestStatusMessage();
                    probeFunctionalTestTriggeringError.PostErrorMessage();
                }
                else
                {
                    _workcell.SendFunctionalTestStatusMessage();
                    probeFunctionalTestTriggeringError.ClearErrorMessage();
                }

                if (HSTMachine.Workcell.LoadCounter.CarrierTriggeringData.SamplingTriggeringOverPercentageActivate && !HSTMachine.Workcell.OffAlertMessage)
                {
                    _workcell.SendSamplingOverTargetTriggeringStatusMessage();
                    samplingOverLimitTriggeringError.PostErrorMessage();
                }
                else
                {
                    _workcell.SendSamplingOverTargetTriggeringStatusMessage();
                    samplingOverLimitTriggeringError.ClearErrorMessage();
                }

                if (TowerLightAndDoorStatusEvent != null)
                {
                    TowerLightAndDoorStatusEvent(this, new TowerLightAndDoorLockStatusEventArgs(enableAmberTowerLight, enableRedTowerLight, _controller.isDoorLocked()));
                }

                if (_controller.isAutomationStopButtonPressed() || ((_controller.isAutomationPrepareToStop()) && _controller.isAutomationEnabled()))
                {
                    HSTWorkcell.disableBoundaryCheck = false;
                    if (HSTMachine.Workcell.Process.IsRunState)
                    {
                        PublishSignal(new QEvent(HSTWorkcell.SigStopMachineRun));
                    }
                    preparetoStopAutomation = true;
                    if (HSTMachine.Workcell.HSTSettings.Install.EnableDebugLog)
                    {
                        Log.Info(this, "preparetoStopAutomation. isAutomationStopButtonPressed: {0}, isAutomationPrepareToStop: {1}", _controller.isAutomationStopButtonPressed(), _controller.isAutomationPrepareToStop());
                    }
                }

                if (HSTMachine.Workcell.Process.IsRunState)
                {
                    conveyorCongestionTimer.Start();
                    conveyorCongestionTimer.Elapsed -= conveyorCongestionTimer_Elapsed;
                    conveyorCongestionTimer.Elapsed += conveyorCongestionTimer_Elapsed;
                }
                else
                {
                    conveyorCongestionTimer.Stop();
                    conveyorCongestionTimer.Elapsed -= conveyorCongestionTimer_Elapsed;
                }

                DetermineButtonsLEDState();
                DetermineTowerLightState();

                if (HSTMachine.Workcell.HSTSettings.Install.OperationMode == OperationMode.Simulation)
                {
                    mainDoorIsNotLocked.TriggerError = false;
                }

                if (_controller.isEMOPressed())
                {
                    emoTriggered.TriggerError = true;
                    CommonFunctions.Instance.powerOnConveyor = false;
                }
                else
                {
                    emoTriggered.TriggerError = false;
                }

                if (prepareEMOReset && _controller.isPowerOn())
                {
                    prepareEMOReset = false;
                    if (EMOReset != null)
                    {
                        EMOReset(this, new EventArgs());
                    }
                }

                if (!emoTriggered.TriggerError && emoTriggeredPrev)
                {
                    prepareEMOReset = true;
                    CommonFunctions.Instance.powerOnConveyor  = true;
                    CommonFunctions.Instance.powerOffConveyor = false;
                }

                if (preparetoStopAutomation && !HSTMachine.Workcell.Process.IsRunState)
                {
                    preparetoStopAutomation = false;
                    stopAutomation          = true;
                }

                if (HSTMachine.Workcell.HSTSettings.Install.OperationMode != OperationMode.Simulation)
                {
                    if ((Controller.isAutomationStopButtonPressed()) || stopAutomation)
                    {
                        _controller.EnableAllEndEffectorAxes(false);
                    }
                }

                DateTime currentTime = DateTime.Now;
                TimeSpan diffTime    = currentTime.Subtract(_lastConveyorCongestionTime);

                if (HSTMachine.Workcell.HSTSettings.Install.ConveyorCongestionToleranceTimeLimit > 0)
                {
                    conveyorCongestion.TriggerError = ((int)diffTime.TotalSeconds >= HSTMachine.Workcell.HSTSettings.Install.ConveyorCongestionToleranceTimeLimit) ? true : false;
                }
                else
                {
                    conveyorCongestion.TriggerError = false;
                }

                List <string> errorList = _controller.getErrorList();

                if (errorList.Count > 0)
                {
                    // KA Gan: shouldn't line below be safetyControllerPresentError.TriggerError = true;  ?
                    safetyControllerPresentError.TriggerError = false;

                    string errorInfo = "";
                    for (int i = 0; i < errorList.Count; i++)
                    {
                        errorInfo = errorInfo + errorList[i] + Environment.NewLine;
                    }

                    safetyControllerPresentError.SetErrorInfo(errorInfo);
                }
                else
                {
                    safetyControllerPresentError.TriggerError = false;
                }

                if (HSTMachine.Workcell.HSTSettings.Install.OperationMode != OperationMode.Simulation)
                {
                    MonitorErrorMessage.Checking();
                }

                if ((mainDoorIsNotLocked.TriggerError && !mainDoorIsNotLockedPrev) ||
                    (emoTriggered.TriggerError && !emoTriggeredPrev) ||
                    HSTWorkcell.stopSystemDueToAxisError)
                {
                    // KA Gan: Change system state to Stopped if the EMO button has been pressed.
                    if (HSTMachine.Workcell.HSTSettings.Install.EnableDebugLog)
                    {
                        Log.Info(this, "stopSystemProcess. mainDoorIsNotLocked.TriggerError: {0}, emoTriggered.TriggerError: {1}, stopSystemDueToAxisError: {2}, ", mainDoorIsNotLocked.TriggerError, emoTriggered.TriggerError, HSTWorkcell.stopSystemDueToAxisError);
                    }
                    if (HSTMachine.Instance.MainForm != null)
                    {
                        HSTMachine.Instance.MainForm.getPanelCommand().stopSystemProcess();
                        try
                        {
                            if (emoTriggered.TriggerError || mainDoorIsNotLocked.TriggerError)
                            {
                                _doSoftStartUp.Set(DigitalIOState.Off);
                            }
                        }
                        catch (Exception ex)
                        {
                        }
                    }
                    HSTWorkcell.stopSystemDueToAxisError = false;
                }
                mainDoorIsNotLockedPrev = mainDoorIsNotLocked.TriggerError;
                emoTriggeredPrev        = emoTriggered.TriggerError;

                if (enableSiren)
                {
                    SirenCount++;
                }

                if (SirenCount == 2)
                {
                    enableSiren = false;
                    SirenCount  = 0;
                }

                isDoorLockPrev = _controller.isDoorLocked();

                try
                {
                    _controller.SendRequestToSafetyController(enableAmberTowerLight, enableRedTowerLight, enableSiren,
                                                              enablePowerLED, enableAutomationRunLED, enableAutomationStopLED, stopAutomation,
                                                              CommonFunctions.Instance.powerOnConveyor, CommonFunctions.Instance.powerOffConveyor);

                    if (stopAutomation)
                    {
                        stopAutomation = false;
                    }
                }
                catch (Exception ex)
                {
                }

                ////Get axis status
                try
                {
                    bool   erroractive = false;
                    string erroraxis   = string.Empty;
                    string errormsg    = string.Empty;
                    var    thetaStatus = _workcell.Process.PrecisorStationProcess.Controller.GetThetaAxisStatus(HSTIOManifest.Axes.Theta);
                    var    xStatus     = _workcell.Process.PrecisorStationProcess.Controller.GetThetaAxisStatus(HSTIOManifest.Axes.X);
                    var    yStatus     = _workcell.Process.PrecisorStationProcess.Controller.GetThetaAxisStatus(HSTIOManifest.Axes.Y);
                    var    z1Status    = _workcell.Process.PrecisorStationProcess.Controller.GetThetaAxisStatus(HSTIOManifest.Axes.Z1);
                    var    z2Status    = _workcell.Process.PrecisorStationProcess.Controller.GetThetaAxisStatus(HSTIOManifest.Axes.Z2);
                    var    z3Status    = _workcell.Process.PrecisorStationProcess.Controller.GetThetaAxisStatus(HSTIOManifest.Axes.Z3);

                    # region Get axis status
                    if (!thetaStatus.None)
                    {
                        erroractive = true;
                        erroraxis   = String.Format("[{0}] Axis ", HSTIOManifest.Axes.Theta.ToString().ToUpper());
                        errormsg    = thetaStatus.ToString();
                    }

                    if (!xStatus.None)
                    {
                        erroractive = true;
                        erroraxis   = String.Format("[{0}] Axis ", HSTIOManifest.Axes.X.ToString().ToUpper());
                        errormsg    = xStatus.ToString();
                    }

                    if (!yStatus.None)
                    {
                        erroractive = true;
                        erroraxis   = String.Format("[{0}] Axis ", HSTIOManifest.Axes.Y.ToString().ToUpper());
                        errormsg    = yStatus.ToString();
                    }

                    if (!z1Status.None)
                    {
                        erroractive = true;
                        erroraxis   = String.Format("[{0}] Axis ", HSTIOManifest.Axes.Z1.ToString().ToUpper());
                        errormsg    = z1Status.ToString();
                    }

                    if (!z2Status.None)
                    {
                        erroractive = true;
                        erroraxis   = String.Format("[{0}] Axis ", HSTIOManifest.Axes.Z2.ToString().ToUpper());
                        errormsg    = z2Status.ToString();
                    }

                    if (!z3Status.None)
                    {
                        erroractive = true;
                        erroraxis   = String.Format("[{0}] Axis ", HSTIOManifest.Axes.Z3.ToString().ToUpper());
                        errormsg    = z3Status.ToString();
                    }

                    #endregion

                    if (erroractive && !motionError.TriggerError && !_isInMotionAlarmProcess)
                    {
                        _isInMotionAlarmProcess = true;
                        ButtonList lst = new ButtonList(ErrorButton.NoButton, ErrorButton.NoButton, ErrorButton.NoButton);
                        motionError = new MonitorErrorMessage(_workcell, true, String.Format("Aerotech {0} error", erroraxis), lst);
                        motionError.Format(errormsg);
                        motionError.SetWorkInstruction("Please verify motion axis status by using <A3200 Motion Composer>, reset the error and continue run");
                        motionError.IsAutoClearError = true;
                        motionError.TriggerError     = true;
                        motionError.PostErrorMessage();
                    }
                    else
                    {
                        if (!erroractive && motionError.TriggerError)
                        {
                            motionError.ClearErrorMessage();
                            _isInMotionAlarmProcess    = false;
                            motionError.IsErrorCleared = true;
                        }
                    }
                }
Exemple #3
0
 public override void Dispose()
 {
     MonitorErrorMessage.Dispose();
     base.Dispose();
 }