Exemple #1
0
        private QState StatePlaceHGAZDown(IQEvent qEvent)
        {
            LogStateInfo(_processName, System.Reflection.MethodBase.GetCurrentMethod().Name, qEvent);

            if (qEvent.IsSignal(SigStateJob) || qEvent.IsSignal(_sigTimeout))
            {
                try
                {
                    if (_controller.IsSafeToMoveDown(true))
                    {
                        OutputEEDownToLifterPositionTravellingTimeStopWatch.Start();

                        _controller.PlaceHGAMoveDown();
                        OutputEEDownToLifterPositionTravellingTimeStopWatch.Stop();

                        if (HSTMachine.Workcell != null)
                        {
                            if (HSTMachine.Workcell.getPanelOperation() != null)
                            {
                                if (HSTMachine.Workcell.getPanelOperation().getOperationStatusPanel() != null)
                                {
                                    UIUtility.Invoke(HSTMachine.Workcell.getPanelOperation().getOperationStatusPanel(), () =>
                                    {
                                        HSTMachine.Workcell.getPanelOperation().getOperationStatusPanel().labelOutputDownToLifterPositionTravellingTime.Text = OutputEEDownToLifterPositionTravellingTimeStopWatch.ElapsedTime.ToString();
                                    });
                                }
                            }
                        }

                        if (HSTMachine.Workcell.HSTSettings.Install.EnableDebugLog)
                        {
                            if (CommonFunctions.Instance.CollisionAvoidanceBetweenPrecisorNestAndOutputEEMovingDownToOutputCarrierProcessCycleTimeStopWatch.Count > 0)
                            {
                                ProcessStopWatch PSW = CommonFunctions.Instance.CollisionAvoidanceBetweenPrecisorNestAndOutputEEMovingDownToOutputCarrierProcessCycleTimeStopWatch.First();
                                PSW.Stop();
                                CommonFunctions.Instance.LogProcessCycleTime("Collision Avoidance Between Precisor Nest And Output EE Moving Down To Output Carrier Process Cycle Time.csv", PSW.GetElapsedTime(), PSW.CarrierID, PSW.GetStartTime(), PSW.GetStopTime());
                                CommonFunctions.Instance.CollisionAvoidanceBetweenPrecisorNestAndOutputEEMovingDownToOutputCarrierProcessCycleTimeStopWatch.Dequeue();
                            }
                        }

                        OutputEEPlacesDownHGAOntoOutputCarrierProcessCycleTimeStopWatch.Start();

                        TransitionTo(statePlaceHGAVacuumOff);
                    }
                    else
                    {
                        _qTimer.FireIn(new TimeSpan(0, 0, 0, 0, 200), new QEvent(_sigTimeout));
                        return(null);
                    }
                }
                catch (Exception ex)
                {
                    ButtonList btnlst = new ButtonList(ErrorButton.OK, ErrorButton.NoButton, ErrorButton.NoButton);
                    TransitionToErrorState(btnlst, ex);
                }
                return(null);
            }
            return(stateRun);
        }
Exemple #2
0
        private QState StatePickHGAZDown(IQEvent qEvent)
        {
            LogStateInfo(_processName, System.Reflection.MethodBase.GetCurrentMethod().Name, qEvent);

            if (qEvent.IsSignal(SigStateJob) || qEvent.IsSignal(_sigTimeout))
            {
                try
                {
                    if (_controller.IsSafeToMoveDown(false))
                    {
                        OutputEEMovesDownToPrecisorNestPickPositionProcessCycleTimeStopWatch.Start();

                        OutputEEDownToPrecisorNestPositionTravellingTimeStopWatch.Start();

                        bool isUp = (_controller.IncomingCarrier.HGATabType == HGAProductTabType.Up);
                        _controller.PickHGAMoveDown(isUp);
                        HSTMachine.Workcell.Process.PrecisorStationProcess.Controller.TurnOffVaccuumChannels();
                        Thread.Sleep(HSTMachine.Workcell.SetupSettings.Delay.VacuumOffAtPrecisorBeforeOutputEEPick);//original value 250
                        OutputEEDownToPrecisorNestPositionTravellingTimeStopWatch.Stop();

                        if (HSTMachine.Workcell != null)
                        {
                            if (HSTMachine.Workcell.getPanelOperation() != null)
                            {
                                if (HSTMachine.Workcell.getPanelOperation().getOperationStatusPanel() != null)
                                {
                                    UIUtility.Invoke(HSTMachine.Workcell.getPanelOperation().getOperationStatusPanel(), () =>
                                    {
                                        HSTMachine.Workcell.getPanelOperation().getOperationStatusPanel().labelOutputDownToPrecisorNestPositionTravellingTime.Text = OutputEEDownToPrecisorNestPositionTravellingTimeStopWatch.ElapsedTime.ToString();
                                    });
                                }
                            }
                        }

                        OutputEEMovesDownToPrecisorNestPickPositionProcessCycleTimeStopWatch.Stop();
                        if (HSTMachine.Workcell.HSTSettings.Install.EnableDebugLog)
                        {
                            CommonFunctions.Instance.LogProcessCycleTime("Output EE Moves Down To Precisor Nest Pick Position Process Cycle Time.csv", OutputEEMovesDownToPrecisorNestPickPositionProcessCycleTimeStopWatch.ElapsedTime);

                            if (CommonFunctions.Instance.PrecisorNestStabilityAtOutputStationProcessCycleTimeStopWatch.Count > 0)
                            {
                                ProcessStopWatch PSW = CommonFunctions.Instance.PrecisorNestStabilityAtOutputStationProcessCycleTimeStopWatch.First();
                                PSW.Stop();
                                CommonFunctions.Instance.LogProcessCycleTime("Precisor Nest Stability At Output Station Process Cycle Time.csv", PSW.GetElapsedTime(), PSW.CarrierID, PSW.GetStartTime(), PSW.GetStopTime());
                                CommonFunctions.Instance.PrecisorNestStabilityAtOutputStationProcessCycleTimeStopWatch.Dequeue();
                            }
                        }

                        OutputEEPicksUpHGAFromPrecisorNestProcessCycleTimeStopWatch.Start();

                        TransitionTo(statePickHGACheckVacuumAndMoveUp);
                    }
                    else
                    {
                        //lai: reduce from 200 march12-2016
                        _qTimer.FireIn(new TimeSpan(0, 0, 0, 0, 150), new QEvent(_sigTimeout));
                        return(null);
                    }
                }
                catch (Exception ex)
                {
                    ButtonList btnlst = new ButtonList(ErrorButton.OK, ErrorButton.NoButton, ErrorButton.NoButton);
                    TransitionToErrorState(btnlst, ex);
                }
                return(null);
            }
            return(stateRun);
        }
Exemple #3
0
        private QState StateOutputTurnSectionReleaseCarrier(IQEvent qEvent)
        {
            LogStateInfo(_processName, System.Reflection.MethodBase.GetCurrentMethod().Name, qEvent);

            if (qEvent.IsSignal(SigStateJob))
            {
                try
                {
                    // allow turn table to settle before release to avoid boat hit the corner of the output conveyor.
                    Thread.Sleep(HSTMachine.Workcell.SetupSettings.Delay.OutputTurnTableFullyStopDelay);
                    _controller.InhibitOutputTurnStation(false);
                    _controller.WaitOutputTurnStationPartCleared();

                    Thread.Sleep(HSTMachine.Workcell.SetupSettings.Delay.OutputTurnTableReleaseBoatDelay); //required to ensure boat is cleared from turn table
                    _controller.InhibitOutputTurnStation(true);

                    BoatLeavesOutputTurnStationProcessCycleTimeStopWatch.Stop();
                    if (HSTMachine.Workcell.HSTSettings.Install.EnableDebugLog)
                    {
                        CommonFunctions.Instance.LogProcessCycleTime("Boat Leaves Output Turn Station Process Cycle Time.csv", BoatLeavesOutputTurnStationProcessCycleTimeStopWatch.ElapsedTime);
                    }

                    Carrier currentCarrier;

                    //remove the carrier from list (can remove at later stage if required)
                    lock (CommonFunctions.Instance.InputCarriersLock)
                    {
                        currentCarrier = CommonFunctions.Instance.InputCarriers.Dequeue();
                    }


                    if (CommonFunctions.Instance.OverallHGATestProcessCycleTimeStopWatch.Count > 0)
                    {
                        ProcessStopWatch PSW = CommonFunctions.Instance.OverallHGATestProcessCycleTimeStopWatch.First();
                        PSW.Stop();

                        CommonFunctions.Instance.LogProcessCycleTime("Overall HGA Test Process Cycle Time.csv", PSW.GetElapsedTime(), currentCarrier.CarrierID, PSW.GetStartTime(), PSW.GetStopTime());

                        if (!currentCarrier.IsPassThroughMode)
                        {
                            if (CommonFunctions.Instance.CarrierCycleTime != null)
                            {
                                CommonFunctions.Instance.CarrierCycleTime.TimeStampAtOutputTurnTable = DateTime.Now;

                                if (CommonFunctions.Instance.CarrierCycleTimeQueue.Count > 0)
                                {
                                    CarrierCycleTime FirstCarrierCycleTime = CommonFunctions.Instance.CarrierCycleTimeQueue.First();
                                    CommonFunctions.Instance.CarrierCycleTime.OverallProcessCycleTimeSpan = CommonFunctions.Instance.CarrierCycleTime.TimeStampAtOutputTurnTable.Subtract(FirstCarrierCycleTime.TimeStampAtOutputTurnTable);
                                    CommonFunctions.Instance.CarrierCycleTimeQueue.Enqueue(CommonFunctions.Instance.CarrierCycleTime);

                                    CommonFunctions.Instance.CarrierCycleTimeQueue.Dequeue();
                                }
                                else
                                {
                                    CommonFunctions.Instance.CarrierCycleTime.OverallProcessCycleTimeSpan = new TimeSpan(0);
                                    CommonFunctions.Instance.CarrierCycleTimeQueue.Enqueue(CommonFunctions.Instance.CarrierCycleTime);
                                }

                                CommonFunctions.Instance.CarrierCycleTime.LogHGACount();
                                double CycleTimeElapsed = ((CommonFunctions.Instance.CarrierCycleTime.OverallProcessCycleTimeSpan.Hours * 3600) + (CommonFunctions.Instance.CarrierCycleTime.OverallProcessCycleTimeSpan.Minutes * 60) + CommonFunctions.Instance.CarrierCycleTime.OverallProcessCycleTimeSpan.Seconds + (CommonFunctions.Instance.CarrierCycleTime.OverallProcessCycleTimeSpan.Milliseconds / 1000.0));
                                if (CycleTimeElapsed > 0.0)
                                {
                                    HSTMachine.Workcell.LoadCounter.CycleTime = CycleTimeElapsed;
                                }
                            }
                        }

                        CommonFunctions.Instance.OverallHGATestProcessCycleTimeStopWatch.Dequeue();

                        if (HSTMachine.Instance.MainForm.getPanelCommand().buttonRun.Enabled == false)
                        {
                            if (HSTMachine.Workcell != null)
                            {
                                if (HSTMachine.Workcell.getPanelOperation() != null)
                                {
                                    if (HSTMachine.Workcell.getPanelOperation().getOperationStatusPanel() != null)
                                    {
                                        UIUtility.Invoke(HSTMachine.Workcell.getPanelOperation().getOperationMainPanel(), () =>
                                        {
                                            HSTMachine.Workcell.getPanelOperation().getOperationMainPanel().getProductionCounterUserControl().txtSystemUPH.Text          = HSTMachine.Workcell.LoadCounter.UPHString;
                                            HSTMachine.Workcell.getPanelOperation().getOperationMainPanel().getProductionCounterUserControl().txtSystemUPH2.Text         = HSTMachine.Workcell.LoadCounter.UPH2String;
                                            HSTMachine.Workcell.getPanelOperation().getOperationMainPanel().getProductionCounterUserControl().txtSystemCycleTime.Text    = HSTMachine.Workcell.LoadCounter.CycleTimeString;
                                            HSTMachine.Workcell.getPanelOperation().getOperationMainPanel().getProductionCounterUserControl().txtProcessedHGACount.Text  = HSTMachine.Workcell.LoadCounter.ProcessedHGACountString;
                                            HSTMachine.Workcell.getPanelOperation().getOperationMainPanel().getProductionCounterUserControl().txtSamplingCounter.Text    = HSTMachine.Workcell.LoadCounter.GetCurrentSamplingNumber.ToString("F2");
                                            HSTMachine.Workcell.getPanelOperation().getOperationMainPanel().getProductionCounterUserControl().textBoxWRBrigeFailure.Text = HSTMachine.Workcell.LoadCounter.LastWRBridgePercentage.ToString("F2");
                                            HSTMachine.Workcell.LoadCounter.Save();
                                        });
                                    }
                                }
                            }
                        }
                    }

                    TransitionTo(StateOutputTurnSectionTurnBackward);
                }
                catch (Exception ex)
                {
                    ButtonList btnlst = new ButtonList(ErrorButton.Retry, ErrorButton.Stop, ErrorButton.NoButton);
                    TransitionToErrorState(btnlst, ex);
                }
                return(null);
            }
            return(stateRun);
        }
Exemple #4
0
        private QState StateCheckCarrierPresentInOutputTurnStation(IQEvent qEvent)
        {
            if (qEvent.IsSignal(SigStateJob))
            {
                try
                {
                    if (HSTMachine.Workcell.HSTSettings.Install.OperationMode == OperationMode.DryRun && HSTMachine.Workcell.HSTSettings.Install.DryRunWithoutBoat)
                    {
                        Thread.Sleep(1000);
                    }
                    else
                    {
                        _controller.WaitOutputTurnStationPartReady();
                        PublishSignal(new QEvent(HSTWorkcell.SigCarrierIsInOutputTurnStation));
                    }

                    if (HSTMachine.Workcell.HSTSettings.Install.EnableDebugLog)
                    {
                        if (CommonFunctions.Instance.BoatArrivesAtOutputTurnStationFromOutputStationProcessCycleTimeStopWatch.Count > 0)
                        {
                            ProcessStopWatch PSW = CommonFunctions.Instance.BoatArrivesAtOutputTurnStationFromOutputStationProcessCycleTimeStopWatch.First();
                            PSW.Stop();
                            CommonFunctions.Instance.LogProcessCycleTime("Boat Arrives At Output Turn Station From Output Station Process Cycle Time.csv", PSW.GetElapsedTime(), PSW.CarrierID, PSW.GetStartTime(), PSW.GetStopTime());
                            CommonFunctions.Instance.BoatArrivesAtOutputTurnStationFromOutputStationProcessCycleTimeStopWatch.Dequeue();
                        }
                    }

                    BoatLeavesOutputTurnStationProcessCycleTimeStopWatch.Start();

                    if (HSTMachine.Workcell.HSTSettings.Install.EnableDebugLog)
                    {
                        Log.Info(this, "{0}, ProcessName:{1}, StateName:StateWaitForCarrierPresentInOutputTurnStation, Received QSignal:{2} and transition to new State:StateOutputTurnSectionTurnForward", LoggerCategory.StateTransition, _processName, qEvent.QSignal.ToString());
                    }
                    TransitionTo(stateOutputTurnSectionTurnForward);
                }
                catch (Exception ex)
                {
                    ButtonList btnlst = new ButtonList(ErrorButton.Retry, ErrorButton.Stop, ErrorButton.NoButton);
                    TransitionToErrorState(btnlst, ex);
                }
                return(null);
            }
            return(stateRun);
        }
Exemple #5
0
        private QState StatePlaceHgaZDown(IQEvent qEvent)
        {
            LogStateInfo(_processName, System.Reflection.MethodBase.GetCurrentMethod().Name, qEvent);

            if (qEvent.IsSignal(SigStateJob) || qEvent.IsSignal(_sigTimeout))
            {
                try
                {
                    if (_controller.IsSafeToMoveDown(false))
                    {
                        InputEEMovesDownToPrecisorNestProcessCycleTimeStopWatch.Start();

                        InputEEDownToPrecisorNestPositionTravellingTimeStopWatch.Start();
                        HSTWorkcell.inputEEPickDone = false;
                        bool isUp = (_currentInputCarrier.HGATabType == HGAProductTabType.Up);
                        _controller.DoJobMoveZToPlace(isUp, false);
                        InputEEDownToPrecisorNestPositionTravellingTimeStopWatch.Stop();

                        if (HSTMachine.Workcell != null)
                        {
                            if (HSTMachine.Workcell.getPanelOperation() != null)
                            {
                                if (HSTMachine.Workcell.getPanelOperation().getOperationStatusPanel() != null)
                                {
                                    UIUtility.Invoke(HSTMachine.Workcell.getPanelOperation().getOperationStatusPanel(), () =>
                                    {
                                        HSTMachine.Workcell.getPanelOperation().getOperationStatusPanel().labelInputDownToPrecisorNestPositionTravellingTime.Text = InputEEDownToPrecisorNestPositionTravellingTimeStopWatch.ElapsedTime.ToString();
                                    });
                                }
                            }
                        }

                        if (HSTMachine.Workcell.HSTSettings.Install.EnableDebugLog)
                        {
                            if (CommonFunctions.Instance.PrecisorNestStabilityAtInputStationProcessCycleTimeStopWatch.Count > 0)
                            {
                                ProcessStopWatch PSW = CommonFunctions.Instance.PrecisorNestStabilityAtInputStationProcessCycleTimeStopWatch.First();
                                PSW.Stop();
                                CommonFunctions.Instance.LogProcessCycleTime("Precisor Nest Stability At Input Station Process Cycle Time.csv", PSW.GetElapsedTime(), PSW.CarrierID, PSW.GetStartTime(), PSW.GetStopTime());
                                CommonFunctions.Instance.PrecisorNestStabilityAtInputStationProcessCycleTimeStopWatch.Dequeue();
                            }
                        }

                        InputEEMovesDownToPrecisorNestProcessCycleTimeStopWatch.Stop();
                        if (HSTMachine.Workcell.HSTSettings.Install.EnableDebugLog)
                        {
                            CommonFunctions.Instance.LogProcessCycleTime("Input EE Moves Down To Precisor Nest Process Cycle Time.csv", InputEEMovesDownToPrecisorNestProcessCycleTimeStopWatch.ElapsedTime);
                        }

                        TransitionTo(statePlaceHgaVacuumOff);
                    }
                    else
                    {
                        _qTimer.FireIn(new TimeSpan(0, 0, 0, 0, 200), new QEvent(_sigTimeout));
                        return(null);
                    }
                }
                catch (Exception ex)
                {
                    if (_retryCount < 1)
                    {
                        Log.Error(this, "Failed to move Input EE down to place HGAs. Retry count: {0}, Exception: {1}, StateName: {2}", _retryCount, ex.Message, this.CurrentStateName);
                        TransitionTo(this.targetState);
                    }
                    else
                    {
                        ButtonList btnlst = new ButtonList(ErrorButton.OK, ErrorButton.NoButton, ErrorButton.NoButton);
                        TransitionToErrorState(btnlst, ex);
                    }
                    _retryCount++;
                }
                return(null);
            }
            return(stateRun);
        }
Exemple #6
0
        private QState StateMoveTestProbeToProbePosition(IQEvent qEvent)
        {
            LogStateInfo(_processName, System.Reflection.MethodBase.GetCurrentMethod().Name, qEvent);

            if (qEvent.IsSignal(SigRecover))
            {
                if (errorMessage != null)
                {
                    ErrorButton response = (ErrorButton)(((QEvent)qEvent).EventObject);
                    switch (response)
                    {
                    case ErrorButton.Stop:
                    {
                        _retryCount = 0;
                    }
                    break;

                    default:
                        errorMessage = null;
                        System.Windows.Forms.MessageBox.Show(string.Format("Unhandled Button: {0}", response.ToString()), response.ToString());
                        return(null);
                    }
                    return(null);
                }
            }

            if (qEvent.IsSignal(SigStateJob) /* || qEvent.IsSignal(_sigTimeout)*/)
            {
                try
                {
                    if (_controller.IsSafeToMoveDown())
                    {
                        if ((HSTMachine.Workcell.HSTSettings.Install.OperationMode == OperationMode.Bypass && HSTMachine.Workcell.HSTSettings.Install.BypassMeasurementTestAtTestProbe == true))
                        {
                            // Do nothing
                        }
                        else
                        {
                            bool foundMatchingProductType = false;
                            if (String.Compare(CalibrationSettings.Instance.MeasurementTest.CurrentInstalledTestProbeType, CommonFunctions.Instance.MeasurementTestRecipe.RecipeProbeType, true) == 0)
                            {
                                foundMatchingProductType = true;
                                if (HSTMachine.Workcell.HSTSettings.Install.EnableDebugLog)
                                {
                                    Log.Info(this, "In TestProbeProcess' StateMoveTestProbeToProbePosition , found a match in the HGA Product Type database in which the Product ID = {0} and Product Name = {1}.",
                                             CalibrationSettings.Instance.MeasurementTest.CurrentInstalledTestProbeType, CommonFunctions.Instance.MeasurementTestRecipe.RecipeProbeType);
                                }
                            }

                            if (foundMatchingProductType == false)
                            {
                                try
                                {
                                    try
                                    {
                                        throw new Exception(String.Format("Unrecognized Product Name of '{0}'.", _currentInputCarrier.WorkOrderData.ProductName));
                                    }
                                    catch (Exception ex)
                                    {
                                        HSTException.Throw(HSTErrors.TestElectronicsOutdatedMeasurementTestConfiguration, new Exception(String.Format("Unrecognized Product Name of '{0}'.", _currentInputCarrier.WorkOrderData.ProductName)));
                                    }
                                }
                                catch (Exception ex)
                                {
                                    ButtonList btnlst = new ButtonList(ErrorButton.OK, ErrorButton.NoButton, ErrorButton.NoButton);
                                    TransitionToErrorState(btnlst, ex);
                                }
                            }
                        }

                        TestProbeMovesDownToPrecisorNestProbePositionProcessCycleTimeStopWatch.Start();

                        TestProbeDownToTestPositionTravellingTimeStopWatch.Start();
                        bool isUp = (_currentInputCarrier.HGATabType == HGAProductTabType.Up);
                        _controller.GoToProbePosition(isUp, false);

                        TestProbeDownToTestPositionTravellingTimeStopWatch.Stop();

                        if (HSTMachine.Workcell.HSTSettings.Install.OperationMode != OperationMode.Simulation)
                        {
                            _currentInputCarrier.setPrecisorNestPositionZ(_controller.GetTestProbePositionZ());
                        }

                        if (HSTMachine.Workcell != null)
                        {
                            if (HSTMachine.Workcell.getPanelOperation() != null)
                            {
                                if (HSTMachine.Workcell.getPanelOperation().getOperationStatusPanel() != null)
                                {
                                    UIUtility.Invoke(HSTMachine.Workcell.getPanelOperation().getOperationStatusPanel(), () =>
                                    {
                                        HSTMachine.Workcell.getPanelOperation().getOperationStatusPanel().labelDownToTestPositionTravellingTime.Text = TestProbeDownToTestPositionTravellingTimeStopWatch.ElapsedTime.ToString();
                                    });
                                }
                            }
                        }

                        TestProbeStabilityProcessCycleTimeStopWatch.Start();
                        HGAMeasurementTestAtTestProbeProcessCycleTimeStopWatch.Start();

                        if (HSTMachine.Workcell.HSTSettings.Install.EnableDebugLog)
                        {
                            if (CommonFunctions.Instance.TestProbeHandlerMovesDownToPrecisorNestProcessCycleTimeStopWatch.Count > 0)
                            {
                                ProcessStopWatch PSW = CommonFunctions.Instance.TestProbeHandlerMovesDownToPrecisorNestProcessCycleTimeStopWatch.First();
                                PSW.Stop();
                                CommonFunctions.Instance.LogProcessCycleTime("Test Probe Handler Moves Down To Precisor Nest Process Cycle Time.csv.csv", PSW.GetElapsedTime(), PSW.CarrierID, PSW.GetStartTime(), PSW.GetStopTime());
                                CommonFunctions.Instance.TestProbeHandlerMovesDownToPrecisorNestProcessCycleTimeStopWatch.Dequeue();
                            }
                        }

                        TransitionTo(statePublishSigRequestForHGATesting);
                    }
                    else
                    {
                        _qTimer.FireIn(new TimeSpan(0, 0, 0, 0, 200), new QEvent(_sigTimeout));
                        return(null);
                    }
                }
                catch (Exception ex)
                {
                    ButtonList btnlst = new ButtonList(ErrorButton.OK, ErrorButton.NoButton, ErrorButton.NoButton);
                    TransitionToErrorState(btnlst, ex);
                }
                return(null);
            }
            return(stateRun);
        }