예제 #1
0
        protected bool OpticalTest()
        {
            lock (tempScope)
            {
                try
                {
                    bool flagMask = false;

                    apDBM          = InnoExCeption.NaN;
                    er             = InnoExCeption.NaN;
                    crossing       = InnoExCeption.NaN;
                    marginVaulue   = InnoExCeption.NaN;
                    jitterRMS      = InnoExCeption.NaN;
                    jitterPP       = InnoExCeption.NaN;
                    OEOMA          = InnoExCeption.NaN;
                    OEOMADBM       = InnoExCeption.NaN;
                    riseTime       = InnoExCeption.NaN;
                    fallTime       = InnoExCeption.NaN;
                    EyeHeight      = InnoExCeption.NaN;
                    bitRate        = InnoExCeption.NaN;
                    XmarginVaulue2 = InnoExCeption.NaN;

                    //throw new InnoExCeption(ExceptionDictionary.Code._0x02000, "abc");
                    //int ni = 0;
                    //int nj = 5 / ni;

                    //Scope tempScope = (Scope)selectedEquipList["SCOPE"];
                    if (tempScope != null)
                    {
                        tempScope.pglobalParameters = GlobalParameters;
                        double[] tempDoubleArray;

                        //for (int K = 0; K < 4;K++ )
                        //{
                        if (!tempScope.OpticalEyeTest(out tempDoubleArray, 1))
                        {
                            for (byte i = 0; i < tempDoubleArray.Length; i++)
                            {
                                tempDoubleArray[i] = InnoExCeption.NaN;
                            }
                        }
                        if (tempDoubleArray[8] > MaskSpecMax || tempDoubleArray[8] < MaskSpecMin)
                        {
                            flagMask = false;
                        }
                        else
                        {
                            flagMask = true;
                        }
                        if (!flagMask)//后三次测试有一次失败就不在测试
                        {
                            for (int k = 0; k < 3; k++)
                            {
                                if (!tempScope.OpticalEyeTest(out tempDoubleArray))
                                {
                                    for (byte i = 0; i < tempDoubleArray.Length; i++)
                                    {
                                        tempDoubleArray[i] = InnoExCeption.NaN;
                                    }
                                }
                                if (tempDoubleArray[8] > MaskSpecMax || tempDoubleArray[8] < MaskSpecMin)
                                {
                                    break;
                                }
                            }
                        }


                        OEOMA          = tempDoubleArray[2];
                        OEOMADBM       = Algorithm.ChangeUwtoDbm(OEOMA * 1000);
                        jitterRMS      = tempDoubleArray[5];
                        jitterPP       = tempDoubleArray[4];
                        riseTime       = tempDoubleArray[6];
                        fallTime       = tempDoubleArray[7];
                        crossing       = tempDoubleArray[3];
                        er             = tempDoubleArray[1];
                        apDBM          = tempDoubleArray[0];
                        marginVaulue   = tempDoubleArray[8];
                        EyeHeight      = tempDoubleArray[9];
                        bitRate        = tempDoubleArray[10];
                        XmarginVaulue2 = tempDoubleArray[11];
                        //  EyeWidth = tempDoubleArray[10];
                        Log.SaveLogToTxt("apDBM:" + apDBM.ToString());
                        Log.SaveLogToTxt("er:" + er.ToString());
                        Log.SaveLogToTxt("crossing:" + crossing.ToString());
                        Log.SaveLogToTxt("maskVaulue:" + marginVaulue.ToString());
                        Log.SaveLogToTxt("jitterRMS:" + jitterRMS.ToString());
                        Log.SaveLogToTxt("jitterPP:" + jitterPP.ToString());
                        Log.SaveLogToTxt("OEOMA:" + OEOMA.ToString());
                        Log.SaveLogToTxt("OEOMADBM:" + OEOMADBM.ToString());
                        Log.SaveLogToTxt("riseTime:" + riseTime.ToString());
                        Log.SaveLogToTxt("fallTime:" + fallTime.ToString());
                        Log.SaveLogToTxt("bitRate:" + bitRate.ToString());
                        Log.SaveLogToTxt("maskVaulue2:" + XmarginVaulue2.ToString());
                        return(true);
                    }
                    else
                    {
                        Log.SaveLogToTxt("Equipments are not enough!");
                        return(false);
                    }
                }
                catch (InnoExCeption ex)//from driver
                {
                    //Log.SaveLogToTxt(ex.ID + ": " + ex.Message + "\r\n" + ex.StackTrace);
                    exceptionList.Add(ex);
                    return(false);
                }
                catch (Exception error)//from itself
                {
                    //one way: deal this exception itself
                    InnoExCeption ex = new InnoExCeption(ExceptionDictionary.Code._0xFFFFF, error.StackTrace);
                    //Log.SaveLogToTxt(ex.ID + ": " + ex.Message + "\r\n" + ex.StackTrace);
                    exceptionList.Add(ex);
                    return(false);
                    //the other way is: should throw exception, rather than the above three code. see below:
                    //throw new InnoExCeption(ExceptionDictionary.Code._0xFFFFF, error.StackTrace);
                }
            }
        }