Exemple #1
0
        //---------------------------------------------------------------------------
        //Slurry
        private void THREAD_PROCESS_6()
        {
            bool   bGo      = false;
            double Start    = 0;
            double Scan     = 0;
            int    nNo      = TH6;
            int    nInteval = THREAD_INTERVAL6;

            //
            try
            {
                while (m_bThreadRun[nNo])
                {
                    Thread.Sleep(1);

                    if (!bGo)
                    {
                        Start = TICK._GetTickTime();

                        m_bWatchDog[TH6] = false;

                        if (FM.m_stSystemOpt.nUseAutoSlurry == 1)
                        {
                            //Auto Supply Update
                            SUPPLY[0].fn_PlcUpdate(); //SLURRY
                            SUPPLY[1].fn_PlcUpdate(); //SOAP
                        }

                        m_bWatchDog[TH6] = true;

                        Scan = TICK._GetTickTime() - Start;
                        bGo  = true;
                        m_tDelayTimer[nNo].Clear();
                    }

                    if (Scan < nInteval)
                    {
                        if (!m_tDelayTimer[nNo].OnDelay(bGo, nInteval - Scan))
                        {
                            continue;
                        }
                    }

                    bGo = false;

                    //Scan Time Check
                    m_nScanTime [nNo] = (uint)(TICK._GetTickTime() - m_nStartTime[nNo]);
                    m_nStartTime[nNo] = (uint)TICK._GetTickTime();
                }
            }
            catch (System.Exception ex)
            {
                m_bWatchDog[TH6] = false;
                System.Diagnostics.Trace.WriteLine(ex.Message);
                LOG.ExceptionTrace("[THREAD_PROCESS_6]", ex);
            }
        }
Exemple #2
0
        //---------------------------------------------------------------------------
        private void THREAD_PROCESS_7()
        {
            bool   bGo      = false;
            double Start    = 0;
            double Scan     = 0;
            int    idx      = TH7;
            int    interval = THREAD_INTERVAL7;

            //
            try
            {
                while (m_bThreadRun[idx])
                {
                    Thread.Sleep(1);

                    if (!bGo)
                    {
                        Start            = TICK._GetTickTime();
                        m_bWatchDog[TH7] = false;

                        //RFID
                        RFID.fn_Upate();

                        //REST API
                        REST.fn_Upate();

                        m_bWatchDog[TH7] = true;

                        Scan = TICK._GetTickTime() - Start;
                        bGo  = true;
                        m_tDelayTimer[idx].Clear();
                    }

                    if (Scan < interval)
                    {
                        if (!m_tDelayTimer[idx].OnDelay(bGo, interval - Scan))
                        {
                            continue;
                        }
                    }

                    bGo = false;


                    //Scan Time Check
                    m_nScanTime [idx] = (uint)(TICK._GetTickTime() - m_nStartTime[idx]);
                    m_nStartTime[idx] = (uint)TICK._GetTickTime();
                }
            }
            catch (System.Exception ex)
            {
                m_bWatchDog[TH7] = false;
                System.Diagnostics.Trace.WriteLine(ex.Message);
                LOG.ExceptionTrace($"[THREAD_PROCESS_{interval}]", ex);
            }
        }
Exemple #3
0
        //---------------------------------------------------------------------------
        //PMC
        private void THREAD_PROCESS_5()
        {
            bool   bGo   = false;
            double Start = 0;
            double Scan  = 0;


            //
            try
            {
                while (m_bThreadRun[TH5])
                {
                    Thread.Sleep(1);

                    if (!bGo)
                    {
                        Start            = TICK._GetTickTime();
                        m_bWatchDog[TH5] = false;

                        //PMC Update
                        //if(FM.m_stMasterOpt.nUsePMC == 1) PMC.fn_Update();

                        IO.fn_UpdateACSReboot();

                        m_bWatchDog[TH5] = true;

                        Scan = TICK._GetTickTime() - Start;
                        bGo  = true;
                        m_tDelayTimer[TH5].Clear();
                    }

                    if (Scan < THREAD_INTERVAL5)
                    {
                        if (!m_tDelayTimer[TH5].OnDelay(bGo, THREAD_INTERVAL5 - Scan))
                        {
                            continue;
                        }
                    }

                    bGo = false;



                    //Scan Time Check
                    m_nScanTime [TH5] = (uint)(TICK._GetTickTime() - m_nStartTime[TH5]);
                    m_nStartTime[TH5] = (uint)TICK._GetTickTime();
                }
            }
            catch (System.Exception ex)
            {
                m_bWatchDog[TH5] = false;
                System.Diagnostics.Trace.WriteLine(ex.Message);
                LOG.ExceptionTrace("[THREAD_PROCESS_5]", ex);
            }
        }
Exemple #4
0
        //---------------------------------------------------------------------------
        //LoadCell
        private void THREAD_PROCESS_4()
        {
            bool   bGo   = false;
            double Start = 0;
            double Scan  = 0;

            //
            try
            {
                while (m_bThreadRun[TH4])
                {
                    Thread.Sleep(1);

                    if (!bGo)
                    {
                        Start            = TICK._GetTickTime();
                        m_bWatchDog[TH4] = false;

                        //Load Cell Update
                        LDCBTM.fn_Update();

                        //Top Cell Data
                        IO.fn_UpdateTopLDC();

                        m_bWatchDog[TH4] = true;

                        Scan = TICK._GetTickTime() - Start;
                        bGo  = true;
                        m_tDelayTimer[TH4].Clear();
                    }

                    if (Scan < THREAD_INTERVAL4)
                    {
                        if (!m_tDelayTimer[TH4].OnDelay(bGo, THREAD_INTERVAL4 - Scan))
                        {
                            continue;
                        }
                    }

                    bGo = false;

                    //Scan Time Check
                    m_nScanTime [TH4] = (uint)(TICK._GetTickTime() - m_nStartTime[TH4]);
                    m_nStartTime[TH4] = (uint)TICK._GetTickTime();
                }
            }
            catch (System.Exception ex)
            {
                m_bWatchDog[TH4] = false;
                System.Diagnostics.Trace.WriteLine(ex.Message);
                LOG.ExceptionTrace("[THREAD_PROCESS_4]", ex);
            }
        }
Exemple #5
0
        //---------------------------------------------------------------------------
        //MANUAL, Sequence
        private void THREAD_PROCESS_2()
        {
            bool   bGo   = false;
            double Start = 0;
            double Scan  = 0;

            //
            try
            {
                while (m_bThreadRun[TH2])
                {
                    Thread.Sleep(1);

                    if (!bGo)
                    {
                        Start = TICK._GetTickTime();

                        m_bWatchDog[TH2] = false;

                        //Motor Data Update
                        MOTR.fn_Update(SEQ._bRun);

                        m_bWatchDog[TH2] = true;

                        Scan = TICK._GetTickTime() - Start;
                        bGo  = true;
                        m_tDelayTimer[TH2].Clear();
                    }

                    if (Scan < THREAD_INTERVAL2)
                    {
                        if (!m_tDelayTimer[TH2].OnDelay(bGo, THREAD_INTERVAL2 - Scan))
                        {
                            continue;
                        }
                    }

                    bGo = false;


                    //Scan Time Check
                    m_nScanTime [TH2] = (uint)(TICK._GetTickTime() - m_nStartTime[TH2]);
                    m_nStartTime[TH2] = (uint)TICK._GetTickTime();
                }
            }
            catch (System.Exception ex)
            {
                m_bWatchDog[TH2] = false;
                System.Diagnostics.Trace.WriteLine(ex.Message);
                LOG.ExceptionTrace("[THREAD_PROCESS_2]", ex);
            }
        }
Exemple #6
0
        //---------------------------------------------------------------------------
        //Log Process
        private void THREAD_PROCESS_1()
        {
            bool   bGo   = false;
            double Start = 0;
            double Scan  = 0;

            //
            try
            {
                while (m_bThreadRun[TH1])
                {
                    Thread.Sleep(30);

                    if (!bGo)
                    {
                        m_bWatchDog[TH1] = false;

                        //Log
                        LOG.fn_UpdateLog();

                        m_bWatchDog[TH1] = true;


                        bGo = true;
                        m_tDelayTimer[TH1].Clear();
                    }

                    //if(Scan < THREAD_INTERVAL1)
                    //{
                    //    if (!m_tDelayTimer[TH1].OnDelay(bGo, THREAD_INTERVAL1 - Scan)) continue;
                    //}

                    bGo = false;


                    m_dScanTime[TH1] = TICK._GetTickTime() - Start;
                    Start            = TICK._GetTickTime();


                    //Scan Time Check
                    m_nScanTime [TH1] = (uint)(TICK._GetTickTime() - m_nStartTime[TH1]);
                    m_nStartTime[TH1] = (uint)TICK._GetTickTime();
                }
            }
            catch (System.Exception ex)
            {
                m_bWatchDog[TH1] = false;
                System.Diagnostics.Trace.WriteLine(ex.Message);
                LOG.ExceptionTrace("[THREAD_PROCESS_1]", ex);
            }
        }
Exemple #7
0
        //---------------------------------------------------------------------------
        private void THREAD_PROCESS_10()
        {
            bool   bGo      = false;
            double Start    = 0;
            double Scan     = 0;
            int    idx      = TH10;
            int    interval = THREAD_INTERVAL10;
            int    nIdex    = 0;

            //
            try
            {
                while (m_bThreadRun[idx])
                {
                    Thread.Sleep(1);

                    if (!bGo)
                    {
                        Start = TICK._GetTickTime();

                        //Check Thread
                        for (nIdex = 0; nIdex < MAX_THREAD - 1; nIdex++)
                        {
                            if (!m_bThreadRun[nIdex])
                            {
                                continue;
                            }

                            if (nIdex >= TH7)
                            {
                                continue;
                            }

                            m_tChkTimer[nIdex].OnDelay(!m_bWatchDog[nIdex], 3000);
                            if (m_tChkTimer[nIdex].Out)
                            {
                                //Console.WriteLine(string.Format($"THREAD ERROR_{nIdex}"));
                                //EPU.fn_SetErr(ERRID.EN_ERR_LIST.ERR_0120 + nIdex); //JUNG/200605
                            }
                        }


                        Scan = TICK._GetTickTime() - Start;
                        bGo  = true;
                        m_tDelayTimer[idx].Clear();
                    }

                    if (Scan < interval)
                    {
                        if (!m_tDelayTimer[idx].OnDelay(bGo, interval - Scan))
                        {
                            continue;
                        }
                    }

                    bGo = false;

                    //Scan Time Check
                    m_nScanTime [idx] = (uint)(TICK._GetTickTime() - m_nStartTime[idx]);
                    m_nStartTime[idx] = (uint)TICK._GetTickTime();
                }
            }
            catch (System.Exception ex)
            {
                System.Diagnostics.Trace.WriteLine(ex.Message);
                LOG.ExceptionTrace($"[THREAD_PROCESS_{interval}]", ex);
            }
        }
Exemple #8
0
        //---------------------------------------------------------------------------
        private void THREAD_PROCESS_9()
        {
            bool   bGo      = false;
            double Start    = 0;
            double Scan     = 0;
            int    idx      = TH9;
            int    interval = THREAD_INTERVAL9;

            m_TryCount_Cam = 0;
            //
            try
            {
                while (m_bThreadRun[idx])
                {
                    Thread.Sleep(1);

                    if (!bGo)
                    {
                        Start            = TICK._GetTickTime();
                        m_bWatchDog[TH9] = false;

                        // Cam Connection Try
                        if (g_VisionManager._CamManager.CameraRetryCount < 12)
                        {
                            if (g_VisionManager._CamManager.fn_OpenCam() == true)
                            {
                                g_VisionManager._CamManager.CameraRetryCount = 12;
                            }
                            else
                            {
                                g_VisionManager._CamManager.CameraRetryCount++;
                            }
                        }

                        m_bWatchDog[TH9] = true;

                        Scan = TICK._GetTickTime() - Start;
                        bGo  = true;
                        m_tDelayTimer[idx].Clear();
                    }

                    if (Scan < interval)
                    {
                        if (!m_tDelayTimer[idx].OnDelay(bGo, interval - Scan))
                        {
                            continue;
                        }
                    }

                    bGo = false;



                    //Scan Time Check
                    m_nScanTime [idx] = (uint)(TICK._GetTickTime() - m_nStartTime[idx]);
                    m_nStartTime[idx] = (uint)TICK._GetTickTime();
                }
            }
            catch (System.Exception ex)
            {
                m_bWatchDog[TH9] = false;
                System.Diagnostics.Trace.WriteLine(ex.Message);
                LOG.ExceptionTrace($"[THREAD_PROCESS_{interval}]", ex);
            }
        }
Exemple #9
0
        //---------------------------------------------------------------------------
        //Main Process
        private void THREAD_PROCESS_0()
        {
            bool   bGo   = false;
            double Start = 0;
            double Scan  = 0;

            //
            try
            {
                while (m_bThreadRun[TH0])
                {
                    Thread.Sleep(1);

                    if (!bGo)
                    {
                        //-----------------------------------------------
                        Monitor.Enter(Obj);
                        try
                        {
                            m_bWatchDog[TH0] = false;

                            //Main Sequence
                            if (m_bIOOn)
                            {
                                SEQ.fn_Update();
                            }
                            //SEQ.fn_Update1();

                            m_bWatchDog[TH0] = true;
                        }
                        finally
                        {
                            Monitor.Exit(Obj);
                        }
                        //-----------------------------------------------



                        bGo = true;
                        m_tDelayTimer[TH0].Clear();
                    }

                    //if (Scan < THREAD_INTERVAL0)
                    //{
                    //    if (!m_tDelayTimer[TH0].OnDelay(bGo, THREAD_INTERVAL0 - Scan)) continue;
                    //}

                    bGo = false;

                    m_dScanTime[TH0] = TICK._GetTickTime() - Start;
                    Start            = TICK._GetTickTime();


                    //Scan Time Check
                    m_nScanTime [TH0] = (uint)Environment.TickCount - m_nStartTime[TH0];
                    m_nStartTime[TH0] = (uint)Environment.TickCount;
                }
            }
            catch (System.Exception ex)
            {
                m_bWatchDog[TH0] = false;

                System.Diagnostics.Trace.WriteLine(ex.Message);
                LOG.ExceptionTrace("[THREAD_PROCESS_0]", ex);
            }
        }