Ejemplo n.º 1
0
        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);
                }
            }
        }