Exemplo n.º 1
0
        public override bool Test()
        {
            if (AnalysisInputParameters(inputParameters) == false)
            {
                return(false);
            }
            if (!CloseandOpenAPC(Convert.ToByte(APCMODE.IBAISandIMODON)))
            {
                return(false);                                                         //开启APC
            }
            if (ReadyData())
            {
                return(true);//已经填充好了数据,后面不用测试
            }
            else// 没提前准备好数据,需要实际测量
            {
                Log.SaveLogToTxt("Step3...SetAttenValue");
                Log.SaveLogToTxt("Step4...AutoAlaign");
                bool isAutoAlaign = pED.AutoAlaign(true);

                if (isAutoAlaign)
                {
                    Log.SaveLogToTxt(isAutoAlaign.ToString());
                }
                else
                {
                    Log.SaveLogToTxt(isAutoAlaign.ToString());
                    Ber = 1;

                    logoStr = "";
                    return(isAutoAlaign);
                }


                if (flagSingleTest)
                {
                    SingleChannelTest();
                }
                else
                {
                    MultChannelTest();
                }
            }
            return(true);
        }
Exemplo n.º 2
0
        protected override bool StartTest()
        {
            RxPowerArray.Clear();
            BerArray.Clear();

            logoStr = "";
            if (AnalysisInputParameters(inputParameters) == false)
            {
                OutPutandFlushLog();
                return(false);
            }

            //if (testRxOverloadStruct.IsOptSourceUnitOMA)
            //{
            //    testRxOverloadStruct.SpecDelta = Algorithm.CalculateFromOMAtoDBM(testRxOverloadStruct.SpecDelta, Convert.ToDouble(OSERValueArray[GlobalParameters.CurrentChannel - 1]));
            //    testRxOverloadStruct.SpecDelta = Math.Round(testRxOverloadStruct.SpecDelta, 4);
            //    testRxOverloadStruct.CsenAlignRxPwr = Algorithm.CalculateFromOMAtoDBM(testRxOverloadStruct.CsenAlignRxPwr, Convert.ToDouble(OSERValueArray[GlobalParameters.CurrentChannel - 1]));
            //    testRxOverloadStruct.CsenAlignRxPwr = Math.Round(testRxOverloadStruct.CsenAlignRxPwr, 4);
            //}

            if (tempAtten != null && tempED != null && tempps != null)
            {
                // open apc
                {
                    CloseandOpenAPC(Convert.ToByte(APCMODE.IBAISandIMODON));
                }
                // open apc

                //tempAtten.SetAllChannnel_RxOverLoad(10);
                Log.SaveLogToTxt("Step2...SetAttenValue");
                tempAtten.AttnValue(testRxOverloadStruct.CsenAlignRxPwr.ToString());
                Log.SaveLogToTxt("Step3...AutoAlaign");
                bool isAutoAlaign = tempED.AutoAlaign(true);
                if (isAutoAlaign)
                {
                    Log.SaveLogToTxt(isAutoAlaign.ToString());
                    Log.SaveLogToTxt("Step4...StartTestRxOverload");

                    double ber = -1;
                    int    i   = 0;
                    int    LoopCount;
                    double RxPower  = 0;
                    double countMol = testRxOverloadStruct.LoopTime % testRxOverloadStruct.GatingTime;
                    if (countMol == 0)
                    {
                        LoopCount = Convert.ToInt32(testRxOverloadStruct.LoopTime / testRxOverloadStruct.GatingTime);
                    }
                    else
                    {
                        LoopCount = Convert.ToInt32((testRxOverloadStruct.LoopTime - countMol) / testRxOverloadStruct.GatingTime) + 1;
                    }

                    double startPower = 0;
                    if (tempAtten.offsetlist.ContainsKey(tempAtten.CurrentChannel))
                    {
                        startPower = Convert.ToDouble(tempAtten.offsetlist[tempAtten.CurrentChannel]);
                    }

                    do
                    {
                        RxPower = startPower - testRxOverloadStruct.AttStep * i;

                        if (RxPower < testRxOverloadStruct.CsenAlignRxPwr)
                        {
                            OverloadPoint = testRxOverloadStruct.CsenAlignRxPwr;
                            Log.SaveLogToTxt("Can't find OverloadPoint...");
                            break;
                        }
                        else
                        {
                            tempAtten.AttnValue(RxPower.ToString());
                            RxPowerArray.Add(RxPower);
                            Log.SaveLogToTxt("SetAtten=" + RxPower.ToString());

                            tempED.EdGatingStart();    //刷新误码数
                            for (int j = 0; j < LoopCount; j++)
                            {
                                Thread.Sleep(Convert.ToInt32(testRxOverloadStruct.GatingTime * 1000));
                                ber = tempED.QureyEdErrorRatio();
                                Log.SaveLogToTxt("Ber=" + ber.ToString());
                                if (ber != 0)
                                {
                                    BerArray.Add(ber);
                                    break;
                                }
                                else
                                {
                                    if (j == LoopCount - 1)
                                    {
                                        BerArray.Add(ber);
                                    }
                                }
                            }
                        }

                        i++;
                    }while (ber != 0);


                    if (ber == 0 && i != 1)
                    {
                        i          = 0;
                        startPower = RxPower + testRxOverloadStruct.AttStep;
                        do
                        {
                            RxPower = startPower - 0.2 * i;

                            if (RxPower < testRxOverloadStruct.CsenAlignRxPwr)
                            {
                                OverloadPoint = testRxOverloadStruct.CsenAlignRxPwr;
                                Log.SaveLogToTxt("Can't find OverloadPoint...");
                                break;
                            }
                            else
                            {
                                tempAtten.AttnValue(RxPower.ToString());
                                RxPowerArray.Add(RxPower);
                                Log.SaveLogToTxt("SetAtten=" + RxPower.ToString());

                                tempED.EdGatingStart();    //刷新误码数
                                for (int j = 0; j < LoopCount; j++)
                                {
                                    Thread.Sleep(Convert.ToInt32(testRxOverloadStruct.GatingTime * 1000));
                                    ber = tempED.QureyEdErrorRatio();
                                    Log.SaveLogToTxt("Ber=" + ber.ToString());
                                    if (ber != 0)
                                    {
                                        BerArray.Add(ber);
                                        break;
                                    }
                                    else
                                    {
                                        if (j == LoopCount - 1)
                                        {
                                            BerArray.Add(ber);
                                        }
                                    }
                                }
                            }

                            i++;
                        }while (ber != 0);


                        if (ber == 0)
                        {
                            OverloadPoint = RxPower;
                            Log.SaveLogToTxt("OverloadPoint= " + OverloadPoint.ToString());
                        }
                    }
                    else          //光源点无误码
                    {
                        OverloadPoint = RxPower;
                        Log.SaveLogToTxt("OverloadPoint= " + OverloadPoint.ToString() + " LightSource= " + OverloadPoint.ToString());
                    }

                    OutPutandFlushLog();
                    return(true);
                }
                else
                {
                    Log.SaveLogToTxt(isAutoAlaign.ToString());
                    OverloadPoint = -1000;
                    OutPutandFlushLog();
                    return(isAutoAlaign);
                }
            }
            else
            {
                Log.SaveLogToTxt("Equipments are not enough!");
                AnalysisOutputProcData(procData);
                AnalysisOutputParameters(outputParameters);

                return(false);
            }
        }
Exemplo n.º 3
0
        protected override bool StartTest()
        {
            logger.FlushLogBuffer();
            logoStr = "";
            if (AnalysisInputParameters(inputParameters) == false)
            {
                return(false);
            }
            if (selectedEquipList["ATTEN"] != null && selectedEquipList["ERRORDETE"] != null && selectedEquipList["DUT"] != null && selectedEquipList["POWERSUPPLY"] != null)
            {
                Powersupply tempps = (Powersupply)selectedEquipList["POWERSUPPLY"];
                // open apc
                string apcstring = null;
                dut.APCStatus(out apcstring);
                if (apcstring == "OFF" || apcstring == "FF")
                {
                    logoStr += logger.AdapterLogString(0, "Step2...Start Open apc");
                    dut.APCON();
                    logoStr += logger.AdapterLogString(0, "Power off");
                    tempps.Switch(false);
                    Thread.Sleep(200);
                    logoStr += logger.AdapterLogString(0, "Power on");
                    tempps.Switch(true);
                    Thread.Sleep(200);
                    bool isOpen = dut.APCStatus(out apcstring);
                    if (apcstring == "ON")
                    {
                        logoStr += logger.AdapterLogString(1, "APC ON");
                    }
                    else
                    {
                        logoStr += logger.AdapterLogString(3, "APC NOT ON");
                    }
                }
                // open apc
                Attennuator   tempAtten = (Attennuator)selectedEquipList["ATTEN"];
                ErrorDetector tempED    = (ErrorDetector)selectedEquipList["ERRORDETE"];
                logoStr += logger.AdapterLogString(0, "Step3...SetAttenValue");
                SetAttenValue(tempAtten, testBerStruct.CsenAlignRxPwr);
                Thread.Sleep(200);
                tempAtten.Switch(true);
                double attPoint = 0;
                logoStr += logger.AdapterLogString(0, "Step4...AutoAlaign");

                bool isAutoAlaign = tempED.AutoAlaign(true);
                if (isAutoAlaign)
                {
                    logoStr += logger.AdapterLogString(1, isAutoAlaign.ToString());
                }
                else
                {
                    logoStr += logger.AdapterLogString(4, isAutoAlaign.ToString());
                    logger.FlushLogBuffer();
                    return(isAutoAlaign);
                }

                if (isAutoAlaign)
                {
                    if (testBerStruct.IsBerQuickTest == true)
                    {
                        tempAtten.AttnValue(testBerStruct.CsenStartingRxPwr.ToString());
                        Thread.Sleep(200);
                        double sensitivity = tempED.GetErrorRate();
                        logoStr += logger.AdapterLogString(1, "SetAtten=" + testBerStruct.CsenStartingRxPwr.ToString());

                        if (sensitivity.ToString().ToUpper().Trim() == "NAN")
                        {
                            sensitivityPoint = -1000;
                            AnalysisOutputParameters(outputParameters);
                            logger.FlushLogBuffer();
                            return(false);
                        }
                        if (testBerStruct.CsenTargetBER == 1E-3)
                        {
                            if (sensitivity <= 1E-3)
                            {
                                sensitivityPoint = testBerStruct.CsenStartingRxPwr;
                            }
                            else
                            {
                                sensitivityPoint = -1000;
                                logoStr         += logger.AdapterLogString(4, "AttPoint=" + testBerStruct.CsenStartingRxPwr.ToString() + "CSENCE>1E-3 ");
                                AnalysisOutputParameters(outputParameters);
                                logger.FlushLogBuffer();
                                return(false);
                            }
                        }
                        else if (testBerStruct.CsenTargetBER == 1E-12)
                        {
                            if (sensitivity <= 1E-12)
                            {
                                sensitivityPoint = testBerStruct.CsenStartingRxPwr;
                            }
                            else
                            {
                                sensitivityPoint = -1000;
                                logoStr         += logger.AdapterLogString(4, "AttPoint=" + testBerStruct.CsenStartingRxPwr.ToString() + "CSENCE>1E-12 ");
                                AnalysisOutputParameters(outputParameters);
                                logger.FlushLogBuffer();
                                return(false);
                            }
                        }

                        sensitivityPoint = Math.Round(sensitivityPoint, 2);
                        logoStr         += logger.AdapterLogString(1, "sensitivityPoint= " + sensitivityPoint.ToString());
                        AnalysisOutputParameters(outputParameters);
                        logger.FlushLogBuffer();
                        return(true);
                    }
                    else
                    {
                        logoStr += logger.AdapterLogString(0, "Step5...SerchTargetPoint");
                        attPoint = SerchTargetPoint(tempAtten, tempED, testBerStruct.CsenStartingRxPwr, testBerStruct.SearchTargetBerLL, testBerStruct.SearchTargetBerUL, testBerStruct.SearchTargetBerAddStep, testBerStruct.SearchTargetBerSubStep);
                        logoStr += logger.AdapterLogString(1, "SetAtten=" + attPoint.ToString());
                        ArrayList attPoints;
                        ArrayList berPoints;
                        double    intercept;
                        double    slope;
                        logoStr += logger.AdapterLogString(0, "Step6...SerchCoefPoints");
                        if (testBerStruct.CsenTargetBER == 1E-3)
                        {
                            SerchCoefPointsTarget1E3(tempAtten, tempED, attPoint, testBerStruct.CsenTargetBER, testBerStruct.CoefCsenSubStep, testBerStruct.CoefCsenAddStep, out attPoints, out berPoints);
                            byte     tmepCount     = (byte)Math.Min(attPoints.Count, berPoints.Count);
                            double[] tempattPoints = new double[tmepCount];
                            double[] tempberPoints = new double[tmepCount];
                            for (byte i = 0; i < tmepCount; i++)
                            {
                                tempattPoints[i] = double.Parse(attPoints[i].ToString());
                                tempberPoints[i] = double.Parse(berPoints[i].ToString());
                                logoStr         += logger.AdapterLogString(1, "attPoints[ " + i.ToString() + "]" + double.Parse(attPoints[i].ToString()) + "  " + "berPoints[ " + i.ToString() + "]" + double.Parse(berPoints[i].ToString()));
                            }
                            algorithm.LinearRegression(algorithm.Getlog10(algorithm.GetNegative(algorithm.Getlog10(tempberPoints))), tempattPoints, out slope, out intercept);
                            sensitivityPoint = slope + (intercept * System.Math.Log10(System.Math.Log10(testBerStruct.CsenTargetBER) * (-1)));
                        }
                        else if (testBerStruct.CsenTargetBER == 1E-12)
                        {
                            SerchCoefPoints1E12(tempAtten, tempED, attPoint, testBerStruct.CsenTargetBER, testBerStruct.CoefCsenSubStep, testBerStruct.CoefCsenAddStep, out attPoints, out berPoints);
                            byte     tmepCount     = (byte)Math.Min(attPoints.Count, berPoints.Count);
                            double[] tempattPoints = new double[tmepCount];
                            double[] tempberPoints = new double[tmepCount];
                            for (byte i = 0; i < tmepCount; i++)
                            {
                                tempattPoints[i] = double.Parse(attPoints[i].ToString());
                                tempberPoints[i] = double.Parse(berPoints[i].ToString());
                                logoStr         += logger.AdapterLogString(1, "attPoints[ " + i.ToString() + "]" + double.Parse(attPoints[i].ToString()) + "  " + "berPoints[ " + i.ToString() + "]" + double.Parse(berPoints[i].ToString()));
                            }
                            algorithm.LinearRegression(algorithm.Getlog10(algorithm.GetNegative(algorithm.Getlog10(tempberPoints))), tempattPoints, out slope, out intercept);
                            sensitivityPoint = slope + (intercept * System.Math.Log10(System.Math.Log10(testBerStruct.CsenTargetBER) * (-1)));
                        }
                        if (sensitivityPoint.ToString().ToUpper().Trim() == "NAN")
                        {
                            sensitivityPoint = -1000;
                            AnalysisOutputParameters(outputParameters);
                            logger.FlushLogBuffer();
                            return(false);
                        }
                        sensitivityPoint = Math.Round(sensitivityPoint, 2);
                        logoStr         += logger.AdapterLogString(1, "sensitivityPoint= " + sensitivityPoint.ToString());
                        AnalysisOutputParameters(outputParameters);
                        logger.FlushLogBuffer();
                        return(true);
                    }
                }
                else
                {
                    logger.FlushLogBuffer();
                    return(false);
                }
            }
            else
            {
                logoStr += logger.AdapterLogString(4, "Equipments is not enough!");
                logger.FlushLogBuffer();
                return(false);
            }
        }
Exemplo n.º 4
0
        public override bool Test()

        {
            logoStr = "";
            GenerateSpecList(SpecNameArray);
            AddCurrentTemprature();
            if (AnalysisInputParameters(inputParameters) == false)
            {
                OutPutandFlushLog();
                return(false);
            }
            if (!LoadPNSpec())
            {
                OutPutandFlushLog();
                return(false);
            }
            if (pED != null && pAtt != null && pPS != null)
            {
                // close apc

                {
                    CloseandOpenAPC(Convert.ToByte(APCMODE.IBAISandIMODOFF));
                }
                // close apc

                bool isAutoAlaign = pED.AutoAlaign(true);

                if (isAutoAlaign)
                {
                    Log.SaveLogToTxt(isAutoAlaign.ToString());
                }
                else
                {
                    Log.SaveLogToTxt(isAutoAlaign.ToString());

                    OutPutandFlushLog();
                    return(isAutoAlaign);
                }
                pAtt.AttnValue(adjustAPDStruct.RxInputPower.ToString());

                ArrayList serchTargetAtts = new ArrayList();
                ArrayList serchTargetBers = new ArrayList();
                serchTargetAtts.Clear();
                serchTargetBers.Clear();


                switch (adjustAPDStruct.AdjustMethod)
                {
                case 1:
                    if (!AdjustAPDMethod1())
                    {
                        return(false);
                    }
                    break;

                default:
                    if (!AdjustAPDMethod1())
                    {
                        return(false);
                    }
                    break;
                }

                DataRow dr = dtProcess.NewRow();

                dr["Temp"]    = GlobalParameters.CurrentTemp;
                dr["Channel"] = GlobalParameters.CurrentChannel;
                dr["APDDAC"]  = targetApd;

                ushort k;

                switch (adjustAPDStruct.Formula_X_Type)
                { //0=TempAdc;1=ApdTempAdc;2=Current*256
                case 0:
                    dut.ReadTempADC(out k);
                    dr["Formula_X"] = k;
                    break;

                case 1:
                    int TempK;
                    dut.ReadAPDTempAdc(out TempK);
                    dr["Formula_X"] = TempK;
                    break;

                default:
                    dut.ReadTempADC(out k);
                    dr["Formula_X"] = k;
                    break;
                }
                //dr["Formula_X"] = k;

                dtProcess.Rows.Add(dr);



                if (!CurveAPDandWriteCoefs())
                {
                    OutPutandFlushLog();
                }
                OutPutandFlushLog();
                return(true);
            }
            else
            {
                Log.SaveLogToTxt("Equipments are not enough!");
                isApdAdjustOK = false;
                OutPutandFlushLog();
                return(isApdAdjustOK);
            }
        }
        protected override bool StartTest()
        {
            lock (tempAtten)
            {
                logoStr = "";
                if (AnalysisInputParameters(inputParameters) == false)
                {
                    OutPutandFlushLog();
                    return(false);
                }

                GlobalBER_EXPtoRealBer();

                if (testBerStruct.IsOpticalSourceUnitOMA)
                {
                    testBerStruct.CsenAlignRxPwr      = Algorithm.CalculateFromOMAtoDBM(testBerStruct.CsenAlignRxPwr, Convert.ToDouble(OSERValueArray[GlobalParameters.CurrentChannel - 1]));
                    testBerStruct.CsenStartingRxPwr   = Algorithm.CalculateFromOMAtoDBM(testBerStruct.CsenStartingRxPwr, Convert.ToDouble(OSERValueArray[GlobalParameters.CurrentChannel - 1]));
                    testBerStruct.FirstPointRxPowerUL = Algorithm.CalculateFromOMAtoDBM(testBerStruct.FirstPointRxPowerUL, Convert.ToDouble(OSERValueArray[GlobalParameters.CurrentChannel - 1]));
                    testBerStruct.FirstPointRxPowerLL = Algorithm.CalculateFromOMAtoDBM(testBerStruct.FirstPointRxPowerLL, Convert.ToDouble(OSERValueArray[GlobalParameters.CurrentChannel - 1]));
                }

                if (tempAtten != null && tempED != null && tempps != null)
                {
                    // open apc

                    {
                        CloseandOpenAPC(Convert.ToByte(APCMODE.IBAISandIMODON));
                    }

                    // open apc

                    Log.SaveLogToTxt("Step3...SetAttenValue");
                    SetAttenValue(tempAtten, testBerStruct.CsenAlignRxPwr);
                    Log.SaveLogToTxt("Step4...AutoAlaign");
                    bool isAutoAlaign = tempED.AutoAlaign(true);
                    if (isAutoAlaign)
                    {
                        Log.SaveLogToTxt(isAutoAlaign.ToString());
                    }
                    else
                    {
                        Log.SaveLogToTxt(isAutoAlaign.ToString());
                        sensitivityPoint = -5000;
                        OutPutandFlushLog();
                        return(isAutoAlaign);
                    }
                    if (isAutoAlaign)
                    {
                        if (testBerStruct.IsBerQuickTest == true)
                        {
                            QuickTest(tempAtten, tempED);
                            OutPutandFlushLog();
                            return(true);
                        }
                        else
                        {
                            if (!SerchTargetBer(tempAtten, tempED))
                            {
                                OutPutandFlushLog();
                                return(true);
                            }

                            GettingCurvingPointsandFitting(tempAtten, tempED);
                            if (double.IsNaN(sensitivityPoint) || double.IsInfinity(sensitivityPoint))
                            {
                                sensitivityPoint = -1000;
                                OutPutandFlushLog();
                            }
                            sensitivityPoint = Math.Round(sensitivityPoint, 2);
                            Log.SaveLogToTxt("sensitivityPoint= " + sensitivityPoint.ToString());
                            OutPutandFlushLog();
                            return(true);
                        }
                    }
                    else
                    {
                        AnalysisOutputProcData(procData);
                        AnalysisOutputParameters(outputParameters);

                        return(false);
                    }
                }
                else
                {
                    Log.SaveLogToTxt("Equipments are not enough!");
                    AnalysisOutputProcData(procData);
                    AnalysisOutputParameters(outputParameters);

                    return(false);
                }
            }
        }
Exemplo n.º 6
0
        protected override bool StartTest()
        {
            RxPowerArray.Clear();
            BerArrayRX.Clear();
            TxPowerArray.Clear();
            BerArrayTX.Clear();


            logoStr = "";
            if (AnalysisInputParameters(inputParameters) == false)
            {
                OutPutandFlushLog();
                return(false);
            }

            if (tempED != null && tempAttenRX != null && tempAttenTX != null && tempPowerMeter != null && tempps != null)
            {
                if (!CloseandOpenAPC(Convert.ToByte(APCMODE.IBAISandIMODON)))
                {
                    return(false);                                                         //开启APC
                }
                if (!tempPPG.ConfigurePrbsLength(Convert.ToByte(testTxReturnLostToleranceStruct.ReturnLosTolerancePRBS)))
                {
                    return(false);                                                                                                      //Bert码型为PRBS31
                }
                //if (!SetTargetPower(testTxReturnLostToleranceStruct.TargetPower)) return false; //调节反射器处的衰减器,使光功率计值降TargetPower以下

                tempAttenTX.OutPutSwitch(false);

                Log.SaveLogToTxt("Step2...SetAttenValue");
                tempAttenRX.AttnValue(testTxReturnLostToleranceStruct.CsenAlignRxPwr.ToString());
                Log.SaveLogToTxt("Step3...AutoAlaign");

                bool isAutoAlaign = tempED.AutoAlaign(true);
                if (isAutoAlaign)
                {
                    Log.SaveLogToTxt(isAutoAlaign.ToString());
                    Log.SaveLogToTxt("Step4...TestTxReturnLostTolerance");

                    double ber       = -1;
                    int    i         = 0;
                    double RxPower   = 0;
                    int    LoopCount = 0;
                    double countMol  = testTxReturnLostToleranceStruct.LoopTime % testTxReturnLostToleranceStruct.GatingTime;
                    if (countMol == 0)
                    {
                        LoopCount = Convert.ToInt32(testTxReturnLostToleranceStruct.LoopTime / testTxReturnLostToleranceStruct.GatingTime);
                    }
                    else
                    {
                        LoopCount = Convert.ToInt32((testTxReturnLostToleranceStruct.LoopTime - countMol) / testTxReturnLostToleranceStruct.GatingTime) + 1;
                    }

                    do
                    {
                        RxPower = testTxReturnLostToleranceStruct.StartRxPwr + testTxReturnLostToleranceStruct.RXAttStep * i;

                        tempAttenRX.AttnValue(RxPower.ToString());
                        RxPowerArray.Add(RxPower);
                        Log.SaveLogToTxt("SetAttenRX=" + RxPower.ToString());

                        tempED.EdGatingStart();    //刷新误码数
                        for (int j = 0; j < LoopCount; j++)
                        {
                            Thread.Sleep(Convert.ToInt32(testTxReturnLostToleranceStruct.GatingTime * 1000));
                            ber = tempED.QureyEdErrorRatio();
                            Log.SaveLogToTxt("BerRX=" + ber.ToString());
                            if (ber != 0)
                            {
                                BerArrayRX.Add(ber);
                                break;
                            }
                            else
                            {
                                if (j == LoopCount - 1)
                                {
                                    BerArrayRX.Add(ber);
                                }
                            }
                        }

                        i++;
                    }while (ber != 0);

                    if (ber == 0)
                    {
                        NoneBerPoint = RxPower;
                        //tempAttenRX.AttnValue(NoneBerPoint.ToString());
                        Log.SaveLogToTxt("NoneBerPoint= " + NoneBerPoint.ToString());
                    }

                    //tempED.EdGatingStart();    //刷新误码数

                    double value = 11.5;

                    do
                    {
                        StartTxPwr = dut.ReadDmiTxp() - value;
                        if (!this.SetTargetPower(StartTxPwr))
                        {
                            return(false);
                        }

                        tempED.EdGatingStart();    //刷新误码数
                        for (int j = 0; j < LoopCount; j++)
                        {
                            Thread.Sleep(Convert.ToInt32(testTxReturnLostToleranceStruct.GatingTime * 1000));
                            ber = tempED.QureyEdErrorRatio();
                            Log.SaveLogToTxt("BerRX=" + ber.ToString());
                            if (ber != 0)
                            {
                                break;
                            }
                        }

                        if (ber == 0)
                        {
                            TxReturnLosTolerance = tempPowerMeter.ReadPower();
                            Log.SaveLogToTxt("TxReturnLosTolerance= " + TxReturnLosTolerance.ToString());
                            break;
                        }
                        //tempAttenTX.SetAttnValue(40);
                        value += 0.5;
                    } while (value < 13);

                    TxReturnLosTolerance = value;

                    OutPutandFlushLog();
                    return(true);
                }
                else
                {
                    Log.SaveLogToTxt(isAutoAlaign.ToString());
                    TxReturnLosTolerance = -1000;
                    OutPutandFlushLog();
                    return(isAutoAlaign);
                }
            }
            else
            {
                Log.SaveLogToTxt("Equipments are not enough!");
                //AnalysisOutputProcData(procData);
                AnalysisOutputParameters(outputParameters);

                return(false);
            }
        }