Пример #1
0
 public override bool SelectEquipment(EquipmentList aEquipList)
 {
     selectedEquipList.Clear();
     if (aEquipList.Count == 0)
     {
         return(false);
     }
     else
     {
         bool isOK = false;
         selectedEquipList.Clear();
         IList <string>        tempKeys   = aEquipList.Keys;
         IList <EquipmentBase> tempValues = aEquipList.Values;
         for (byte i = 0; i < aEquipList.Count; i++)
         {
             if (tempKeys[i].ToUpper().Contains("SCOPE"))
             {
                 selectedEquipList.Add("SCOPE", tempValues[i]);
                 isOK = true;
             }
             if (tempKeys[i].ToUpper().Contains("POWERSUPPLY"))
             {
                 selectedEquipList.Add("POWERSUPPLY", tempValues[i]);
             }
             if (tempKeys[i].ToUpper().Contains("NA_OPTICALSWITCH"))
             {
                 tempValues[i].CheckEquipmentRole(2, GlobalParameters.CurrentChannel);
             }
         }
         pPower = (Powersupply)selectedEquipList["POWERSUPPLY"];
         pScope = (Scope)selectedEquipList["SCOPE"];
         if (pPower != null && pScope != null)
         {
             isOK = true;
         }
         else
         {
             if (pScope == null)
             {
                 Log.SaveLogToTxt("SCOPE =NULL");
             }
             if (pScope == null)
             {
                 Log.SaveLogToTxt("POWERSUPPLY =NULL");
             }
             isOK = false;
             OutPutandFlushLog();
         }
         if (isOK)
         {
             selectedEquipList.Add("DUT", dut);
             return(isOK);
         }
         return(isOK);
     }
 }
Пример #2
0
        public override bool SelectEquipment(EquipmentList aEquipList)
        {
            selectedEquipList.Clear();
            if (aEquipList.Count == 0)
            {
                selectedEquipList.Add("DUT", dut);
                return(false);
            }
            else
            {
                bool isOK = false;


                for (byte i = 0; i < aEquipList.Count; i++)
                {
                    if (aEquipList.Keys[i].ToUpper().Contains("POWERSUPPLY"))
                    {
                        pPs  = (Powersupply)aEquipList["POWERSUPPLY"];
                        isOK = true;
                    }
                    if (aEquipList.Keys[i].ToUpper().Contains("SPECTROGRAPH"))
                    {
                        pWavemeter = (Spectrograph)aEquipList["WAVEMETER"];
                    }
                    if (aEquipList.Keys[i].ToUpper().Contains("NA_OPTICALSWITCH"))
                    {
                        aEquipList.Values[i].CheckEquipmentRole(1, GlobalParameters.CurrentChannel);
                    }
                }

                if (pPs != null && pWavemeter != null)
                {
                    isOK = true;
                }
                else
                {
                    if (pPs == null)
                    {
                        Log.SaveLogToTxt("POWERSUPPLY =NULL");
                    }
                    if (pWavemeter == null)
                    {
                        Log.SaveLogToTxt("pWavemeter =NULL");
                    }
                    isOK = false;
                    OutPutandFlushLog();
                }
                if (isOK)
                {
                    selectedEquipList.Add("DUT", dut);
                }

                return(isOK);
            }
        }
 public override bool SelectEquipment(EquipmentList aEquipList)
 {
     selectedEquipList.Clear();
     if (aEquipList.Count == 0)
     {
         return(false);
     }
     else
     {
         bool isOK = false;
         selectedEquipList.Clear();
         IList <string>        tempKeys   = aEquipList.Keys;
         IList <EquipmentBase> tempValues = aEquipList.Values;
         for (byte i = 0; i < aEquipList.Count; i++)
         {
             if (tempKeys[i].ToUpper().Contains("ATTEN"))
             {
                 selectedEquipList.Add("ATTEN", tempValues[i]);
             }
             if (tempKeys[i].ToUpper().Contains("POWERSUPPLY"))
             {
                 selectedEquipList.Add("POWERSUPPLY", tempValues[i]);
             }
         }
         tempAtt = (Attennuator)selectedEquipList["ATTEN"];
         tempps  = (Powersupply)selectedEquipList["POWERSUPPLY"];
         if (tempAtt != null && tempps != null)
         {
             isOK = true;
         }
         else
         {
             if (tempAtt == null)
             {
                 Log.SaveLogToTxt("ATTEN =NULL");
             }
             if (tempps == null)
             {
                 Log.SaveLogToTxt("POWERSUPPLY =NULL");
             }
             isOK = false;
             OutPutandFlushLog();
         }
         if (isOK)
         {
             selectedEquipList.Add("DUT", dut);
         }
         else
         {
             isOK = false;
         }
         return(isOK);
     }
 }
Пример #4
0
        public override bool SelectEquipment(EquipmentList equipmentList)
        {
            selectedEquipList.Clear();

            if (equipmentList.Count == 0)
            {
                selectedEquipList.Add("DUT", dut);
                return(false);
            }
            else
            {
                bool isOK = false;

                for (byte i = 0; i < equipmentList.Count; i++)
                {
                    if (equipmentList.Keys[i].ToUpper().Contains("POWERSUPPLY"))
                    {
                        supply = (Powersupply)equipmentList.Values[i];
                        isOK   = true;
                    }

                    if (equipmentList.Keys[i].ToUpper().Contains("AQ2211ATTEN"))
                    {
                        attennuator = (Attennuator)equipmentList.Values[i];
                        isOK        = true;
                    }

                    if (equipmentList.Keys[i].ToUpper().Contains("NA_OPTICALSWITCH"))
                    {
                        equipmentList.Values[i].CheckEquipmentRole(1, GlobalParameters.CurrentChannel);
                    }
                }

                if (supply != null)
                {
                    isOK = true;
                }
                else
                {
                    if (supply == null)
                    {
                        Log.SaveLogToTxt("POWERSUPPLY =NULL");
                    }
                    isOK = false;
                    OutPutandFlushLog();
                }

                if (isOK)
                {
                    selectedEquipList.Add("DUT", dut);
                }
                return(isOK);
            }
        }
Пример #5
0
 protected override bool StartTest()
 {
     logger.FlushLogBuffer();
     logoStr = "";
     if (AnalysisInputParameters(inputParameters) == false)
     {
         logger.FlushLogBuffer();
         return(false);
     }
     if (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
         logoStr   += logger.AdapterLogString(0, "Step3...ReadDmiTemp");
         tempDmi    = dut.ReadDmiTemp();
         tempDmiErr = tempDmi - GlobalParameters.CurrentTemp;
         logoStr   += logger.AdapterLogString(1, "tempDmi=" + tempDmi.ToString());
         logoStr   += logger.AdapterLogString(1, "tempDmiErr=" + tempDmiErr.ToString());
         AnalysisOutputParameters(outputParameters);
         logger.FlushLogBuffer();
         return(true);
     }
     else
     {
         logoStr += logger.AdapterLogString(4, "Equipments is not enough!");
         logger.FlushLogBuffer();
         return(false);
     }
 }
Пример #6
0
 public override bool SelectEquipment(EquipmentList aEquipList)
 {
     pPS = null;
     selectedEquipList.Clear();
     if (aEquipList.Count == 0)
     {
         selectedEquipList.Add("DUT", dut);
         return(false);
     }
     else
     {
         bool isOK = false;
         selectedEquipList.Clear();
         IList <string>        tempKeys   = aEquipList.Keys;
         IList <EquipmentBase> tempValues = aEquipList.Values;
         for (byte i = 0; i < aEquipList.Count; i++)
         {
             if (tempKeys[i].ToUpper().Contains("POWERSUPPLY"))
             {
                 selectedEquipList.Add("POWERSUPPLY", tempValues[i]);
                 pPS = (Powersupply)tempValues[i];
             }
             if (tempKeys[i].ToUpper().Contains("SPECTROGRAPH"))
             {
                 selectedEquipList.Add("SPECTROGRAPH", tempValues[i]);
                 pSpectrograph = (Spectrograph)tempValues[i];
             }
             if (tempKeys[i].ToUpper().Contains("NA_OPTICALSWITCH"))
             {
                 tempValues[i].CheckEquipmentRole(1, GlobalParameters.CurrentChannel);
             }
         }
         if (pPS != null && pSpectrograph != null)
         {
             isOK = true;
         }
         else
         {
             isOK = false;
         }
         if (isOK)
         {
             selectedEquipList.Add("DUT", dut);
         }
         else
         {
             isOK = false;
         }
         return(isOK);
     }
 }
Пример #7
0
        public override bool SelectEquipment(EquipmentList aEquipList)
        {
            pPS = null;

            pED = null;
            selectedEquipList.Clear();
            if (aEquipList.Count == 0)
            {
                selectedEquipList.Add("DUT", dut);
                return(false);
            }
            else
            {
                bool isOK = false;
                selectedEquipList.Clear();
                IList <string>        tempKeys   = aEquipList.Keys;
                IList <EquipmentBase> tempValues = aEquipList.Values;
                for (byte i = 0; i < aEquipList.Count; i++)
                {
                    if (tempKeys[i].ToUpper().Contains("ERRORDETE"))

                    {
                        selectedEquipList.Add("ERRORDETE", tempValues[i]);
                        pED = (ErrorDetector)tempValues[i];
                    }

                    if (tempKeys[i].ToUpper().Contains("POWERSUPPLY"))
                    {
                        selectedEquipList.Add("POWERSUPPLY", tempValues[i]);
                        pPS = (Powersupply)tempValues[i];
                    }
                }
                if (pPS != null && pED != null)
                {
                    isOK = true;
                }
                else
                {
                    isOK = false;
                }
                if (isOK)
                {
                    selectedEquipList.Add("DUT", dut);
                }
                else
                {
                    isOK = false;
                }
                return(isOK);
            }
        }
Пример #8
0
 protected bool ReadVccADCTM(DUT inputDut, Powersupply inputPowerSupply)
 {
     for (byte i = 0; i < GlobalParameters.TotalVccCount; i++)
     {
         for (byte j = 0; j < calVccDmiStruct.ArrayListVcc.Count; j++)
         {
             inputPowerSupply.ConfigVoltageCurrent(Convert.ToString(Convert.ToDouble(calVccDmiStruct.ArrayListVcc[i]) + GlobalParameters.VccOffset));
             Thread.Sleep(1000);
             UInt16 temp;
             dut.ReadVccADC(out temp, (byte)(i + 1));
             vccAdcArray[i, j] = Convert.ToDouble(temp);
         }
     }
     return(true);
 }
Пример #9
0
        public override bool SelectEquipment(EquipmentList aEquipList)
        {
            selectedEquipList.Clear();
            if (aEquipList.Count == 0)
            {
                return(false);
            }
            else
            {
                bool isOK = false;
                selectedEquipList.Clear();
                IList <string>        tempKeys   = aEquipList.Keys;
                IList <EquipmentBase> tempValues = aEquipList.Values;
                for (byte i = 0; i < aEquipList.Count; i++)
                {
                    if (tempKeys[i].ToUpper().Contains("SCOPE"))
                    {
                        selectedEquipList.Add("SCOPE", tempValues[i]);
                        isOK = true;
                    }
                    if (tempKeys[i].ToUpper().Contains("POWERSUPPLY"))
                    {
                        selectedEquipList.Add("POWERSUPPLY", tempValues[i]);
                    }
                    if (tempKeys[i].ToUpper().Contains("ATTEN"))
                    {
                        selectedEquipList.Add("ATTEN", tempValues[i]);
                    }
                    if (tempKeys[i].ToUpper().Contains("NA_OPTICALSWITCH"))
                    {
                        tempValues[i].CheckEquipmentRole(2, GlobalParameters.CurrentChannel);
                    }
                }
                tempps = (Powersupply)selectedEquipList["POWERSUPPLY"];
                try
                {
                    if (selectedEquipList["ATTEN"] == null)
                    {
                        tempAtten = null;
                    }
                    else
                    {
                        tempAtten = (Attennuator)selectedEquipList["ATTEN"];
                    }
                }
                catch (InnoExCeption ex)//from driver
                {
                    //Log.SaveLogToTxt(ex.ID + ": " + ex.Message + "\r\n" + ex.StackTrace);
                    exceptionList.Add(ex);
                }
                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);
                    //the other way is: should throw exception, rather than the above three code. see below:
                    //throw new InnoExCeption(ExceptionDictionary.Code._0xFFFFF, error.StackTrace);
                }
                // if (selectedEquipList["ATTEN"]==null)
                //{
                //    tempAtten = null;
                //}
                //else
                //{
                //    tempAtten = (Attennuator)selectedEquipList["ATTEN"];
                //}
                tempScope = (Scope)selectedEquipList["SCOPE"];
                if (tempps != null && tempScope != null)
                {
                    if (tempAtten == null)
                    {
                        Log.SaveLogToTxt("ATTEN =NULL");
                    }

                    isOK = true;
                }
                else
                {
                    if (tempScope == null)
                    {
                        Log.SaveLogToTxt("SCOPE =NULL");
                    }
                    if (tempAtten == null)
                    {
                        Log.SaveLogToTxt("ATTEN =NULL");
                    }
                    if (tempps == null)
                    {
                        Log.SaveLogToTxt("POWERSUPPLY =NULL");
                    }

                    OutPutandFlushLog();
                    isOK = false;
                }
                if (isOK)
                {
                    selectedEquipList.Add("DUT", dut);
                    return(isOK);
                }

                return(isOK);
            }
        }
Пример #10
0
        protected override bool StartTest()
        {
            logger.FlushLogBuffer();
            logoStr = "";
            calledCount++;
            if (calledCount > 1)
            {
                logger.AdapterLogString(0, "calledCount>1");
                return(true);
            }
            if (AnalysisInputParameters(inputParameters) == false)
            {
                return(false);
            }
            if (selectedEquipList["POWERSUPPLY"] != null && selectedEquipList["DUT"] != null)
            {
                bool isWriteCoefCOk = false;
                bool isWriteCoefBOk = false;
                bool isWriteCoefAOk = false;

                Powersupply tempps = (Powersupply)selectedEquipList["POWERSUPPLY"];
                // close apc
                string apcstring = null;
                dut.APCStatus(out apcstring);
                if (apcstring == "ON" || apcstring == "FF")
                {
                    logoStr += logger.AdapterLogString(0, "Step2...Start close apc");
                    dut.APCOFF();
                    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 isclosed = dut.APCStatus(out apcstring);
                    if (apcstring == "OFF")
                    {
                        logoStr += logger.AdapterLogString(1, "APC OFF");
                    }
                    else
                    {
                        logoStr += logger.AdapterLogString(3, "APC NOT OFF");
                    }
                }
                // close apc
                vccAdcArray = new double[GlobalParameters.TotalVccCount, calVccDmiStruct.ArrayListVcc.Count];
                ReadVccADCTM(dut, tempps);
                logoStr += logger.AdapterLogString(0, "Step3...Start Fitting Curve");
                double[] tempVccArray = new double[calVccDmiStruct.ArrayListVcc.Count];
                for (byte i = 0; i < calVccDmiStruct.ArrayListVcc.Count; i++)
                {
                    tempVccArray[i] = Convert.ToDouble(calVccDmiStruct.ArrayListVcc[i].ToString());
                }
                tempps.ConfigVoltageCurrent(Convert.ToString(GlobalParameters.VccOffset + calVccDmiStruct.generalVcc));
                if (calVccDmiStruct.is1Stor2StorPid == 1)
                {
                    for (byte i = 0; i < tempVccArray.Length; i++)
                    {
                        tempVccArray[i] = tempVccArray[i] * 10000;
                    }
                    for (byte i = 0; i < GlobalParameters.TotalVccCount; i++)
                    {
                        double[] tempAdc = new double[calVccDmiStruct.ArrayListVcc.Count];
                        for (byte j = 0; j < calVccDmiStruct.ArrayListVcc.Count; j++)
                        {
                            tempAdc[j] = vccAdcArray[i, j];
                        }
                        double[] coefArray = algorithm.MultiLine(tempAdc, tempVccArray, calVccDmiStruct.ArrayListVcc.Count, 1);
                        vccDmiCoefC = (float)coefArray[0];
                        vccDmiCoefB = (float)coefArray[1];
                        vccDmiCoefB = vccDmiCoefB * 256;
                        double[] tempCoefArray = new double[2] {
                            vccDmiCoefC, vccDmiCoefB
                        };
                        vccDmiCoefArray = ArrayList.Adapter(coefArray);
                        vccDmiCoefArray.Reverse();
                        for (byte k = 0; k < vccDmiCoefArray.Count; k++)
                        {
                            logoStr += logger.AdapterLogString(1, "vccDmiCoefArray[" + k.ToString() + "]=" + vccDmiCoefArray[k].ToString() + " " + algorithm.ByteArraytoString(2, ",", algorithm.INT16To2Bytes(vccDmiCoefArray[k])));
                        }
                        logoStr += logger.AdapterLogString(0, "Step4...WriteCoef");
                        #region W&R Vcccoefc
                        isWriteCoefCOk = dut.SetVcccoefc(vccDmiCoefC.ToString(), (byte)(i + 1));
                        if (isWriteCoefCOk)
                        {
                            isWriteCoefCOk = true;
                            logoStr       += logger.AdapterLogString(1, "WritevccDmiCoefC:" + isWriteCoefCOk.ToString());
                        }
                        else
                        {
                            isWriteCoefCOk = false;
                            logoStr       += logger.AdapterLogString(3, "WritevccDmiCoefC:" + isWriteCoefCOk.ToString());
                        }
                        #endregion
                        #region W&R Vcccoefb
                        isWriteCoefBOk = dut.SetVcccoefb(vccDmiCoefB.ToString(), (byte)(i + 1));

                        if (isWriteCoefBOk)
                        {
                            isWriteCoefBOk = true;
                            logoStr       += logger.AdapterLogString(1, "WritevccDmiCoefB:" + isWriteCoefBOk.ToString());
                        }

                        else
                        {
                            isWriteCoefBOk = false;
                            logoStr       += logger.AdapterLogString(3, "WritevccDmiCoefB:" + isWriteCoefBOk.ToString());
                        }
                        #endregion
                        if (isWriteCoefBOk & isWriteCoefCOk)
                        {
                            isCalVccDmiOk = true;

                            logoStr += logger.AdapterLogString(1, "isCalVccDmiOk:" + isCalVccDmiOk.ToString());
                        }
                        else
                        {
                            isCalVccDmiOk = false;
                            logoStr      += logger.AdapterLogString(3, "isCalVccDmiOk:" + isCalVccDmiOk.ToString());
                        }
                    }
                }
                else if (calVccDmiStruct.is1Stor2StorPid == 2)
                {
                    for (byte i = 0; i < tempVccArray.Length; i++)
                    {
                        tempVccArray[i] = tempVccArray[i] * 10000;
                    }
                    for (byte i = 0; i < GlobalParameters.TotalVccCount; i++)
                    {
                        double[] tempAdc = new double[calVccDmiStruct.ArrayListVcc.Count];

                        for (byte j = 0; j < calVccDmiStruct.ArrayListVcc.Count; j++)
                        {
                            tempAdc[j] = vccAdcArray[i, j];
                        }
                        double[] coefArray = algorithm.MultiLine(tempAdc, tempVccArray, calVccDmiStruct.ArrayListVcc.Count, 2);
                        vccDmiCoefC = (float)coefArray[0];
                        vccDmiCoefB = (float)coefArray[1];
                        vccDmiCoefA = (float)coefArray[2];

                        vccDmiCoefArray = ArrayList.Adapter(coefArray);
                        vccDmiCoefArray.Reverse();
                        for (byte k = 0; k < vccDmiCoefArray.Count; k++)
                        {
                            logoStr += logger.AdapterLogString(1, "vccDmiCoefArray[" + k.ToString() + "]=" + vccDmiCoefArray[k].ToString() + " " + algorithm.ByteArraytoString(2, ",", algorithm.INT16To2Bytes(vccDmiCoefArray[k])));
                        }
                        logoStr += logger.AdapterLogString(0, "Step4...WriteCoef");
                        #region W&R Vcccoefc
                        isWriteCoefCOk = dut.SetVcccoefc(vccDmiCoefC.ToString());
                        if (isWriteCoefCOk)
                        {
                            isWriteCoefCOk = true;
                            logoStr       += logger.AdapterLogString(1, "WritevccDmiCoefC:" + isWriteCoefCOk.ToString());
                        }
                        else
                        {
                            isWriteCoefCOk = false;
                            logoStr       += logger.AdapterLogString(3, "WritevccDmiCoefC:" + isWriteCoefCOk.ToString());
                        }
                        #endregion
                        #region W&R Vcccoefb
                        isWriteCoefBOk = dut.SetVcccoefb(vccDmiCoefB.ToString(), (byte)(i + 1));

                        if (isWriteCoefBOk)
                        {
                            isWriteCoefBOk = true;

                            logoStr += logger.AdapterLogString(1, "WritevccDmiCoefB:" + isWriteCoefBOk.ToString());
                        }
                        else
                        {
                            isWriteCoefBOk = false;
                            logoStr       += logger.AdapterLogString(3, "WritevccDmiCoefB:" + isWriteCoefBOk.ToString());
                        }
                        #endregion
                        #region W&R Vcccoefa
                        //isWriteCoefAOk = dut.SetVcccoefa(vccDmiCoefA.ToString(), i + 1);
                        if (isWriteCoefAOk)
                        {
                            isWriteCoefAOk = true;
                            logoStr       += logger.AdapterLogString(1, "WritevccDmiCoefA:" + isWriteCoefAOk.ToString());
                        }
                        else
                        {
                            isWriteCoefAOk = false;
                            logoStr       += logger.AdapterLogString(3, "WritevccDmiCoefA:" + isWriteCoefAOk.ToString());
                        }
                        #endregion
                        if (isWriteCoefBOk & isWriteCoefCOk & isWriteCoefAOk)
                        {
                            isCalVccDmiOk = true;
                            logoStr      += logger.AdapterLogString(1, "isCalVccDmiOk:" + isCalVccDmiOk.ToString());
                        }
                        else
                        {
                            isCalVccDmiOk = false;
                            logoStr      += logger.AdapterLogString(3, "isCalVccDmiOk:" + isCalVccDmiOk.ToString());
                        }
                    }
                }
            }
            else
            {
                logoStr      += logger.AdapterLogString(4, "Equipments is not enough!");
                isCalVccDmiOk = false;
                logger.FlushLogBuffer();
                return(isCalVccDmiOk);
            }
            AnalysisOutputParameters(outputParameters);
            logger.FlushLogBuffer();
            return(isCalVccDmiOk);
        }
Пример #11
0
        protected override bool StartTest()
        {
            logger.FlushLogBuffer();
            logoStr = "";
            if (AnalysisInputParameters(inputParameters) == false)
            {
                logger.FlushLogBuffer();
                return(false);
            }
            if (selectedEquipList["DUT"] != null && selectedEquipList["ATTEN"] != null && selectedEquipList["POWERSUPPLY"] != null)
            {
                Attennuator tempAtt = (Attennuator)selectedEquipList["ATTEN"];
                Powersupply tempps  = (Powersupply)selectedEquipList["POWERSUPPLY"];
                // close apc
                string apcstring = null;
                dut.APCStatus(out apcstring);
                if (apcstring == "ON" || apcstring == "FF")
                {
                    logoStr += logger.AdapterLogString(0, "Step2...Start close apc");
                    dut.APCOFF();
                    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 isclosed = dut.APCStatus(out apcstring);
                    if (apcstring == "OFF")
                    {
                        logoStr += logger.AdapterLogString(1, "APC OFF");
                    }
                    else
                    {
                        logoStr += logger.AdapterLogString(3, "APC NOT OFF");
                    }
                }
                // close apc
                logoStr += logger.AdapterLogString(0, "Step3...Start Adjust LosA");
                if (adjustLosStruct.islosalosdcombin)
                {
                    logoStr += logger.AdapterLogString(1, "Set LosA RxPower:" + adjustLosStruct.LosAInputPower.ToString());
                    tempAtt.AttnValue(adjustLosStruct.LosAInputPower.ToString());
                    isLosA   = LosAEqualLosDAdjust(adjustLosStruct.LosAVoltageStartValue, adjustLosStruct.LosAVoltageTuneStep, adjustLosStruct.LosAVoltageUperLimit, adjustLosStruct.LosAVoltageLowLimit, dut, adjustLosStruct.LosToleranceStep, out targetLosAac);
                    logoStr += logger.AdapterLogString(1, "targetLosADac=" + targetLosDac.ToString());
                    logoStr += logger.AdapterLogString(1, isLosA.ToString());
                }
                else
                {
                    logoStr += logger.AdapterLogString(1, "Set LosA RxPower:" + adjustLosStruct.LosAInputPower.ToString());

                    tempAtt.AttnValue(adjustLosStruct.LosAInputPower.ToString());
                    isLosA   = OneSectionMethodLosAdjust(adjustLosStruct.LosAVoltageStartValue, adjustLosStruct.LosAVoltageTuneStep, adjustLosStruct.LosAVoltageUperLimit, adjustLosStruct.LosAVoltageLowLimit, dut, adjustLosStruct.LosToleranceStep, out targetLosDac);
                    logoStr += logger.AdapterLogString(1, "targetLosADac=" + targetLosDac.ToString());
                    logoStr += logger.AdapterLogString(1, isLosA.ToString());
                    logoStr += logger.AdapterLogString(0, "Step4...Start Adjust LosD");
                    logoStr += logger.AdapterLogString(1, "Set LosD RxPower:" + adjustLosStruct.LosDInputPower.ToString());

                    tempAtt.AttnValue(adjustLosStruct.LosDInputPower.ToString());
                    isLosD = OneSectionMethodLosDAdjust(adjustLosStruct.LosDVoltageStartValue, adjustLosStruct.LosDVoltageTuneStep, adjustLosStruct.LosDVoltageUperLimit, adjustLosStruct.LosDVoltageLowLimit, dut, adjustLosStruct.LosToleranceStep, out targetLosDac);

                    logoStr += logger.AdapterLogString(1, "targetLosDDac=" + targetLosDac.ToString());
                    logoStr += logger.AdapterLogString(1, isLosD.ToString());
                }

                AnalysisOutputParameters(outputParameters);
                if (adjustLosStruct.islosalosdcombin)
                {
                    logger.FlushLogBuffer();
                    return(isLosA);
                }
                else
                {
                    logger.FlushLogBuffer();
                    return(isLosA == true && isLosD == true);
                }
            }
            else
            {
                logoStr += logger.AdapterLogString(4, "Equipments is not enough!");
                logger.FlushLogBuffer();
                return(false);
            }
        }
        protected override bool StartTest()
        {
            logger.FlushLogBuffer();
            logoStr = "";
            if (!channelArray.ContainsKey(GlobalParameters.CurrentChannel.ToString().Trim().ToUpper()))
            {
                channelArray.Add(GlobalParameters.CurrentChannel.ToString().Trim().ToUpper(), GlobalParameters.CurrentChannel.ToString().Trim().ToUpper());
            }
            else
            {
                logger.AdapterLogString(0, "Curren Channel had exist");
                return(true);
            }
            if (AnalysisInputParameters(inputParameters) == false)
            {
                logger.FlushLogBuffer();
                return(false);
            }
            if (selectedEquipList["ATTEN"] != null && selectedEquipList["DUT"] != null && selectedEquipList["POWERSUPPLY"] != null)
            {
                bool isWriteCoefCOk = false;
                bool isWriteCoefBOk = false;
                bool isWriteCoefAOk = false;

                Attennuator tempAtten = (Attennuator)selectedEquipList["ATTEN"];
                Powersupply tempps    = (Powersupply)selectedEquipList["POWERSUPPLY"];
                // close apc
                string apcstring = null;
                dut.APCStatus(out apcstring);
                if (apcstring == "ON" || apcstring == "FF")
                {
                    logoStr += logger.AdapterLogString(0, "Step2...Start close apc");

                    dut.APCOFF();
                    logoStr += logger.AdapterLogString(0, "Power off");

                    tempps.Switch(false);
                    Thread.Sleep(200);
                    logoStr += logger.AdapterLogString(0, "Power on");

                    tempps.Switch(true);
                    Thread.Sleep(500);
                    bool isclosed = dut.APCStatus(out apcstring);
                    if (apcstring == "OFF")
                    {
                        logoStr += logger.AdapterLogString(1, "APC OFF");
                    }
                    else
                    {
                        logoStr += logger.AdapterLogString(3, "APC NOT OFF");
                    }
                }
                // close apc
                rxPoweruwArray  = new double[calRxDmiStruct.ArrayListRxPower.Count];
                rxPowerAdcArray = new double[calRxDmiStruct.ArrayListRxPower.Count];
                for (byte i = 0; i < calRxDmiStruct.ArrayListRxPower.Count; i++)
                {
                    rxPoweruwArray[i] = algorithm.ChangeDbmtoUw(Convert.ToDouble(calRxDmiStruct.ArrayListRxPower[i])) * 10;
                    tempAtten.AttnValue(calRxDmiStruct.ArrayListRxPower[i].ToString());
                    Thread.Sleep(1000);
                    UInt16 Temp;
                    dut.ReadRxpADC(out Temp);
                    rxPowerAdcArray[i] = Convert.ToDouble(Temp);
                }
                logoStr += logger.AdapterLogString(0, "Step3...Start Fitting Curve");
                if (calRxDmiStruct.is1Stor2StorPid == 1)
                {
                    double[] coefArray = algorithm.MultiLine(rxPowerAdcArray, rxPoweruwArray, calRxDmiStruct.ArrayListRxPower.Count, 1);
                    rxDmiCoefC = (float)coefArray[0];
                    rxDmiCoefB = (float)coefArray[1];
                    double[] tempCoefArray = new double[2] {
                        rxDmiCoefC, rxDmiCoefB
                    };

                    rxDmiCoefArray = ArrayList.Adapter(tempCoefArray);
                    rxDmiCoefArray.Reverse();
                    for (byte i = 0; i < rxDmiCoefArray.Count; i++)
                    {
                        logoStr += logger.AdapterLogString(1, "rxDmiCoefArray[" + i.ToString() + "]=" + rxDmiCoefArray[i].ToString() + " " + algorithm.ByteArraytoString(2, ",", algorithm.INT16To2Bytes(rxDmiCoefArray[i])));
                    }
                    logoStr += logger.AdapterLogString(0, "Step4...WriteCoef");
                    #region W&RRxpcoefc
                    isWriteCoefCOk = dut.SetRxpcoefc(rxDmiCoefC.ToString());

                    if (isWriteCoefCOk)
                    {
                        isWriteCoefCOk = true;
                        logoStr       += logger.AdapterLogString(1, "WriterxDmiCoefC:" + isWriteCoefCOk.ToString());
                    }
                    else
                    {
                        isWriteCoefCOk = false;

                        logoStr += logger.AdapterLogString(3, "WriterxDmiCoefC:" + isWriteCoefCOk.ToString());
                    }
                    #endregion
                    #region W&R Rxpcoefb
                    isWriteCoefBOk = dut.SetRxpcoefb(rxDmiCoefB.ToString());

                    if (isWriteCoefBOk)
                    {
                        isWriteCoefBOk = true;
                        logoStr       += logger.AdapterLogString(1, "WriterxDmiCoefB:" + isWriteCoefBOk.ToString());
                    }
                    else
                    {
                        isWriteCoefCOk = false;
                        logoStr       += logger.AdapterLogString(3, "WriterxDmiCoefB:" + isWriteCoefBOk.ToString());
                    }
                    #endregion
                    if (isWriteCoefCOk & isWriteCoefBOk)
                    {
                        isCalRxDmiOk = true;
                        logoStr     += logger.AdapterLogString(1, "isCalRxDmiOk:" + isCalRxDmiOk.ToString());
                    }
                    else
                    {
                        isCalRxDmiOk = false;
                        logoStr     += logger.AdapterLogString(3, "isCalRxDmiOk:" + isCalRxDmiOk.ToString());
                    }
                }
                else if (calRxDmiStruct.is1Stor2StorPid == 2)
                {
                    double[] coefArray = algorithm.MultiLine(rxPowerAdcArray, rxPoweruwArray, calRxDmiStruct.ArrayListRxPower.Count, 2);
                    rxDmiCoefC     = (float)coefArray[0];
                    rxDmiCoefB     = (float)coefArray[1];
                    rxDmiCoefA     = (float)coefArray[2];
                    rxDmiCoefArray = ArrayList.Adapter(coefArray);
                    rxDmiCoefArray.Reverse();
                    for (byte i = 0; i < rxDmiCoefArray.Count; i++)
                    {
                        logoStr += logger.AdapterLogString(1, "rxDmiCoefArray[" + i.ToString() + "]=" + rxDmiCoefArray[i].ToString() + " " + algorithm.ByteArraytoString(2, ",", algorithm.INT16To2Bytes(rxDmiCoefArray[i])));
                    }
                    logoStr += logger.AdapterLogString(0, "Step4...WriteCoef");

                    #region W&RRxpcoefc
                    isWriteCoefCOk = dut.SetRxpcoefc(rxDmiCoefC.ToString());

                    if (isWriteCoefCOk)
                    {
                        isWriteCoefCOk = true;
                        logoStr       += logger.AdapterLogString(1, "WriterxDmiCoefC:" + isWriteCoefCOk.ToString());
                    }
                    else
                    {
                        isWriteCoefCOk = false;
                        logoStr       += logger.AdapterLogString(3, "WriterxDmiCoefC:" + isWriteCoefCOk.ToString());
                    }
                    #endregion
                    #region W&R Rxpcoefb
                    isWriteCoefBOk = dut.SetRxpcoefb(rxDmiCoefB.ToString());
                    //dut.ReadRxpcoefb(out tempString);
                    if (isWriteCoefBOk)
                    {
                        isWriteCoefBOk = true;
                        logoStr       += logger.AdapterLogString(1, "WriterxDmiCoefB:" + isWriteCoefBOk.ToString());
                    }
                    else
                    {
                        isWriteCoefCOk = false;
                        logoStr       += logger.AdapterLogString(3, "WriterxDmiCoefB:" + isWriteCoefBOk.ToString());
                    }
                    #endregion
                    #region W&R Rxpcoefa
                    isWriteCoefAOk = dut.SetRxpcoefa(rxDmiCoefA.ToString());

                    if (isWriteCoefAOk)
                    {
                        isWriteCoefAOk = true;
                        logoStr       += logger.AdapterLogString(1, "WriterxDmiCoefA:" + isWriteCoefAOk.ToString());
                    }
                    else
                    {
                        isWriteCoefAOk = false;
                        logoStr       += logger.AdapterLogString(3, "WriterxDmiCoefA:" + isWriteCoefAOk.ToString());
                    }
                    #endregion
                    if (isWriteCoefCOk & isWriteCoefBOk & isWriteCoefAOk)
                    {
                        isCalRxDmiOk = true;
                        logoStr     += logger.AdapterLogString(1, "isCalRxDmiOk:" + isCalRxDmiOk.ToString());
                    }
                    else
                    {
                        isCalRxDmiOk = false;
                        logoStr     += logger.AdapterLogString(3, "isCalRxDmiOk:" + isCalRxDmiOk.ToString());
                    }
                }
            }
            else
            {
                isCalRxDmiOk = false;
                logoStr     += logger.AdapterLogString(4, "Equipments is not enough!");
                logger.FlushLogBuffer();
                return(isCalRxDmiOk);
            }
            AnalysisOutputParameters(outputParameters);
            logger.FlushLogBuffer();
            return(isCalRxDmiOk);
        }
Пример #13
0
        protected override bool StartTest()
        {
            logger.FlushLogBuffer();
            logoStr = "";
            if (AnalysisInputParameters(inputParameters) == false)
            {
                logger.FlushLogBuffer();
                return(false);
            }

            if (selectedEquipList["ERRORDETE"] != null && selectedEquipList["ATTEN"] != null && selectedEquipList["DUT"] != null && selectedEquipList["POWERSUPPLY"] != null)
            {
                bool isWriteCoefCOk = false;
                bool isWriteCoefBOk = false;
                bool isWriteCoefAOk = false;

                ErrorDetector tempED  = (ErrorDetector)selectedEquipList["ERRORDETE"];
                Attennuator   tempAtt = (Attennuator)selectedEquipList["ATTEN"];
                Powersupply   tempps  = (Powersupply)selectedEquipList["POWERSUPPLY"];
                // add logo infor
                logoStr += logger.AdapterLogString(0, "Setp2...SetAttenPoint:" + adjustAPDStruct.ApdCalPoint.ToString());
                // add logo infor
                bool ok = tempAtt.AttnValue(adjustAPDStruct.ApdCalPoint.ToString());
                // add logo infor
                logoStr += logger.AdapterLogString(0, ok.ToString());
                // close apc
                string apcstring = null;
                dut.APCStatus(out apcstring);
                if (apcstring == "ON" || apcstring == "FF")
                {
                    logoStr += logger.AdapterLogString(0, "Step3...Start close apc");
                    dut.APCOFF();
                    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 isclosed = dut.APCStatus(out apcstring);
                    if (apcstring == "OFF")
                    {
                        logoStr += logger.AdapterLogString(1, "APC OFF");
                    }
                    else
                    {
                        logoStr += logger.AdapterLogString(3, "APC OFF");
                    }
                }
                // close apc

                UInt32[] tempApdArray = new UInt32[adjustAPDStruct.ArrayListApdBiasPoints.Count];
                for (byte i = 0; i < adjustAPDStruct.ArrayListApdBiasPoints.Count; i++)
                {
                    tempApdArray[i] = Convert.ToUInt32(adjustAPDStruct.ArrayListApdBiasPoints[i].ToString());
                }
                logoStr += logger.AdapterLogString(0, "Step4...StartCalApd");
                ArrayList tempBerArray    = new ArrayList();
                ArrayList tempApdDacArray = new ArrayList();
                double    minBer          = -1;
                UInt32    targetAPDAC     = EnumMethod(tempApdArray, dut, tempED, adjustAPDStruct.ApdBiasStep, out tempBerArray, out tempApdDacArray, out minBer);
                minBer = Math.Round(minBer, 5);
                for (byte i = 0; i < Math.Min(tempBerArray.Count, tempApdDacArray.Count); i++)
                {
                    logoStr += logger.AdapterLogString(1, GlobalParameters.CurrentChannel.ToString());
                    logoStr += logger.AdapterLogString(1, tempApdDacArray[i].ToString() + "  " + tempApdDacArray[i].ToString());
                }
                logoStr      += logger.AdapterLogString(1, "minApdDac=" + targetAPDAC.ToString() + "  minBer=" + minBer.ToString());
                isApdAdjustOK = true;
                #region  CheckTempChange
                if (!tempratureADCArray.ContainsKey(GlobalParameters.CurrentTemp.ToString().Trim().ToUpper()))
                {
                    logoStr += logger.AdapterLogString(0, "Step4...TempChanged Read tempratureADC");
                    logoStr += logger.AdapterLogString(1, "realtemprature=" + GlobalParameters.CurrentTemp.ToString());

                    UInt16 tempratureADC;
                    dut.ReadTempADC(out tempratureADC, 1);
                    logoStr += logger.AdapterLogString(1, "tempratureADC=" + tempratureADC.ToString());
                    tempratureADCArray.Add(GlobalParameters.CurrentTemp.ToString().Trim().ToUpper(), tempratureADC.ToString().Trim());
                    tempratureADCArrayList.Add(tempratureADC);
                }
                #endregion
                #region  add current channel
                if (!adjustAPDtValueRecordsStruct.ContainsKey(GlobalParameters.CurrentChannel.ToString().Trim().ToUpper()))
                {
                    logoStr += logger.AdapterLogString(0, "Step6...add current channel records");
                    logoStr += logger.AdapterLogString(1, "GlobalParameters.CurrentChannel=" + GlobalParameters.CurrentChannel.ToString());
                    adjustAPDtValueRecordsStruct.Add(GlobalParameters.CurrentChannel.ToString().Trim().ToUpper(), new ArrayList());
                    adjustAPDtValueRecordsStruct[GlobalParameters.CurrentChannel.ToString().Trim().ToUpper()].Add(targetAPDAC);
                }
                else
                {
                    adjustAPDtValueRecordsStruct[GlobalParameters.CurrentChannel.ToString().Trim().ToUpper()].Add(targetAPDAC);
                }


                #endregion
                #region  CurveCoef

                if (adjustAPDtValueRecordsStruct.ContainsKey(GlobalParameters.CurrentChannel.ToString().Trim().ToUpper()))
                {
                    if (tempratureADCArray.Count >= 2 && adjustAPDtValueRecordsStruct[GlobalParameters.CurrentChannel.ToString().Trim().ToUpper()].Count >= 2)
                    {
                        int      tempCount        = Math.Min(tempratureADCArray.Count, adjustAPDtValueRecordsStruct[GlobalParameters.CurrentChannel.ToString().Trim().ToUpper()].Count);
                        double[] tempAPDDacArray  = new double[tempCount];
                        double[] tempTempAdcArray = new double[tempCount];
                        for (byte i = 0; i < tempCount; i++)
                        {
                            tempAPDDacArray[i]  = double.Parse(adjustAPDtValueRecordsStruct[GlobalParameters.CurrentChannel.ToString().Trim().ToUpper()][i].ToString());
                            tempTempAdcArray[i] = double.Parse(tempratureADCArrayList[i].ToString());
                        }
                        logoStr += logger.AdapterLogString(0, "Step8...Start Fitting Curve");

                        if (adjustAPDStruct.is1Stor2StorPid == 2)
                        {
                            double[] coefArray = algorithm.MultiLine(tempTempAdcArray, tempAPDDacArray, tempratureADCArray.Count, 2);
                            apdPowerCoefC = (float)coefArray[0];
                            apdPowerCoefB = (float)coefArray[1];
                            apdPowerCoefA = (float)coefArray[2];
                            apdCoefArray  = ArrayList.Adapter(coefArray);
                            apdCoefArray.Reverse();
                            for (byte i = 0; i < apdCoefArray.Count; i++)
                            {
                                logoStr += logger.AdapterLogString(1, "apdCoefArray[" + i.ToString() + "]=" + apdCoefArray[i].ToString() + " " + algorithm.ByteArraytoString(2, ",", algorithm.FloatToIEE754(apdCoefArray[i])));
                            }
                            logoStr += logger.AdapterLogString(0, "Step9...WriteCoef");

                            #region W&R Apddaccoefc
                            isWriteCoefCOk = dut.SetBiasdaccoefc(apdPowerCoefC.ToString());
                            if (isWriteCoefCOk)
                            {
                                isWriteCoefCOk = true;
                                logoStr       += logger.AdapterLogString(1, "isWriteCoefCOk:" + isWriteCoefCOk.ToString());
                            }
                            else
                            {
                                isWriteCoefCOk = false;
                                logoStr       += logger.AdapterLogString(3, "isWriteCoefCOk:" + isWriteCoefCOk.ToString());
                            }
                            #endregion
                            #region W&R Apddaccoefb
                            isWriteCoefBOk = dut.SetBiasdaccoefb(apdPowerCoefB.ToString());
                            if (isWriteCoefBOk)
                            {
                                isWriteCoefBOk = true;
                                logoStr       += logger.AdapterLogString(1, "isWriteCoefBOk:" + isWriteCoefBOk.ToString());
                            }
                            else
                            {
                                isWriteCoefBOk = false;
                                logoStr       += logger.AdapterLogString(3, "isWriteCoefBOk:" + isWriteCoefBOk.ToString());
                            }
                            #endregion
                            #region W&R Apddaccoefa
                            isWriteCoefAOk = dut.SetBiasdaccoefa(apdPowerCoefA.ToString());

                            if (isWriteCoefAOk)
                            {
                                isWriteCoefAOk = true;
                                logoStr       += logger.AdapterLogString(1, "isWriteCoefAOk:" + isWriteCoefAOk.ToString());
                            }
                            else
                            {
                                isWriteCoefAOk = false;
                                logoStr       += logger.AdapterLogString(3, "isWriteCoefAOk:" + isWriteCoefAOk.ToString());
                            }
                            #endregion
                            if (isWriteCoefAOk & isWriteCoefBOk & isWriteCoefCOk)
                            {
                                isCalApdPowerOk = true;
                                logoStr        += logger.AdapterLogString(1, "isCalApdPowerOk:" + isCalApdPowerOk.ToString());
                            }
                            else
                            {
                                isCalApdPowerOk = false;
                                logoStr        += logger.AdapterLogString(3, "isCalApdPowerOk:" + isCalApdPowerOk.ToString());
                            }
                        }
                        else if (adjustAPDStruct.is1Stor2StorPid == 1)
                        {
                            double[] coefArray = algorithm.MultiLine(tempTempAdcArray, tempAPDDacArray, tempratureADCArray.Count, 1);
                            apdPowerCoefC = (float)coefArray[0];
                            apdPowerCoefB = (float)coefArray[1];
                            apdPowerCoefA = (float)coefArray[2];
                            apdCoefArray  = ArrayList.Adapter(coefArray);
                            apdCoefArray.Reverse();
                            for (byte i = 0; i < apdCoefArray.Count; i++)
                            {
                                logoStr += logger.AdapterLogString(1, "apdCoefArray[" + i.ToString() + "]=" + apdCoefArray[i].ToString() + " " + algorithm.ByteArraytoString(2, ",", algorithm.FloatToIEE754(apdCoefArray[i])));
                            }
                            logoStr += logger.AdapterLogString(0, "Step9...WriteCoef");

                            #region W&R Apddaccoefc
                            isWriteCoefCOk = dut.SetBiasdaccoefc(apdPowerCoefC.ToString());

                            if (isWriteCoefCOk)
                            {
                                isWriteCoefCOk = true;
                                logoStr       += logger.AdapterLogString(1, "isWriteCoefCOk:" + isWriteCoefCOk.ToString());
                            }
                            else
                            {
                                isWriteCoefCOk = false;
                                logoStr       += logger.AdapterLogString(3, "isWriteCoefCOk:" + isWriteCoefCOk.ToString());
                            }
                            #endregion
                            #region W&R Apddaccoefb
                            isWriteCoefBOk = dut.SetBiasdaccoefb(apdPowerCoefB.ToString());
                            if (isWriteCoefBOk)
                            {
                                isWriteCoefBOk = true;
                                logoStr       += logger.AdapterLogString(0, "isWriteCoefBOk:" + isWriteCoefBOk.ToString());
                            }
                            else
                            {
                                isWriteCoefBOk = false;
                                logoStr       += logger.AdapterLogString(3, "isWriteCoefBOk:" + isWriteCoefBOk.ToString());
                            }
                            #endregion

                            if (isWriteCoefBOk & isWriteCoefCOk)
                            {
                                isCalApdPowerOk = true;
                                logoStr        += logger.AdapterLogString(1, "isCalApdPowerOk:" + isCalApdPowerOk.ToString());
                            }
                            else
                            {
                                isCalApdPowerOk = false;
                                logoStr        += logger.AdapterLogString(3, "isCalApdPowerOk:" + isCalApdPowerOk.ToString());
                            }
                        }
                    }
                }

                #endregion
                AnalysisOutputParameters(outputParameters);
                logger.FlushLogBuffer();
                return(isApdAdjustOK);
            }
            else
            {
                logoStr      += logger.AdapterLogString(4, "Equipments is not enough!");
                isApdAdjustOK = false;
                logger.FlushLogBuffer();
                return(isApdAdjustOK);
            }
        }
Пример #14
0
        public override bool SelectEquipment(EquipmentList eqList)
        {
            selectedEquipList.Clear();
            if (eqList.Count == 0)
            {
                selectedEquipList.Add("DUT", dut);
                return(false);
            }
            else
            {
                bool isOK = false;
                selectedEquipList.Clear();
                IList <string>        tempKeys   = eqList.Keys;
                IList <EquipmentBase> tempValues = eqList.Values;
                for (byte i = 0; i < eqList.Count; i++)
                {
                    if (tempKeys[i].ToUpper().Contains("ATTEN_RX"))
                    {
                        selectedEquipList.Add("ATTEN_RX", tempValues[i]);
                        isOK = true;
                    }

                    if (tempKeys[i].ToUpper().Contains("SCOPE"))
                    {
                        selectedEquipList.Add("SCOPE", tempValues[i]);
                        isOK = true;
                    }

                    if (tempKeys[i].ToUpper().Contains("POWERSUPPLY"))
                    {
                        selectedEquipList.Add("POWERSUPPLY", tempValues[i]);
                    }
                }

                attRx  = (Attennuator)selectedEquipList["ATTEN_RX"];
                scope  = (Scope)selectedEquipList["SCOPE"];
                supply = (Powersupply)selectedEquipList["POWERSUPPLY"];

                if (attRx != null && scope != null && supply != null)
                {
                    isOK = true;
                }
                else
                {
                    if (attRx == null)
                    {
                        Log.SaveLogToTxt("attRx =NULL");
                    }

                    if (scope == null)
                    {
                        Log.SaveLogToTxt("scope =NULL");
                    }

                    if (supply == null)
                    {
                        Log.SaveLogToTxt("supply =NULL");
                    }

                    OutPutandFlushLog();
                    isOK = false;
                }
                if (isOK)
                {
                    selectedEquipList.Add("DUT", dut);
                    return(isOK);
                }
                return(isOK);
            }
        }
Пример #15
0
        protected override bool StartTest()
        {
            logger.FlushLogBuffer();
            logoStr = "";
            //// 是否要测试需要添加判定

            if (AnalysisInputParameters(inputParameters) == false)
            {
                logger.FlushLogBuffer();
                return(false);
            }
            if (PrepareEnvironment(selectedEquipList) == false)
            {
                logger.FlushLogBuffer();
                return(false);
            }
            if (selectedEquipList["POWERSUPPLY"] != null && selectedEquipList["SCOPE"] != 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
                logoStr += logger.AdapterLogString(0, "Step3...StartTestOptical Eye");
                if (testEyeStruct.isOpticalEyeORElecEye)
                {
                    logoStr += logger.AdapterLogString(0, "OpticalEyeTest");
                    OpticalTest();
                }
                else
                {
                    logoStr += logger.AdapterLogString(0, "ElecEyeTest");
                    ElecTest();
                }
                AnalysisOutputParameters(outputParameters);//test
                logger.FlushLogBuffer();
                return(true);
            }
            else
            {
                logoStr += logger.AdapterLogString(4, "Equipments is not enough!");
                logger.FlushLogBuffer();
                return(false);
            }
        }
Пример #16
0
        protected override bool StartTest()
        {
            logger.FlushLogBuffer();
            logoStr = "";
            if (AnalysisInputParameters(inputParameters) == false)
            {
                logger.FlushLogBuffer();
                return(false);
            }
            bool   isLosA = false;
            bool   isLosD = true;
            double tempRxPoint;

            tempRxPoint = testRXLosADStruct.LosAMax;
            if (selectedEquipList["DUT"] != null && selectedEquipList["ATTEN"] != 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(0, "APC ON");
                    }
                    else
                    {
                        logoStr += logger.AdapterLogString(3, "APC NOT ON");
                    }
                }
                // open apc
                Attennuator tempAtten = (Attennuator)selectedEquipList["ATTEN"];
                logoStr += logger.AdapterLogString(0, "Step3...TestLosA");
                if (testRXLosADStruct.isLosDetail)
                {
                    isLosA = LOSADetailTest(tempAtten, tempRxPoint, false);
                }
                else
                {
                    isLosA = LOSAQuickTest(tempAtten, testRXLosADStruct.LosAMin, false);
                }

                if (isLosA == false)
                {
                    logoStr += logger.AdapterLogString(3, "losA=" + isLosA.ToString());
                    return(false);
                }
                tempRxPoint = losA;
                logoStr    += logger.AdapterLogString(1, "losA=" + losA.ToString());
                logoStr    += logger.AdapterLogString(0, "Step5...TestLosD");
                if (testRXLosADStruct.isLosDetail)
                {
                    isLosD = LOSDDetailTest(tempAtten, tempRxPoint, true);
                }
                else
                {
                    isLosD = LOSDQuickTest(tempAtten, testRXLosADStruct.LosDMax, true);
                }

                if (isLosD == false)
                {
                    logoStr += logger.AdapterLogString(3, "losD=" + (!isLosD).ToString());
                    return(false);
                }
                losH     = losD - losA;
                logoStr += logger.AdapterLogString(1, "losD=" + losD.ToString() + "losH=" + losH.ToString());
                AnalysisOutputParameters(outputParameters);
                logger.FlushLogBuffer();
                return((isLosD == true) && (isLosA == true));
            }
            else
            {
                logoStr += logger.AdapterLogString(4, "Equipments is not enough!");
                logger.FlushLogBuffer();
                return(false);
            }
        }
Пример #17
0
        protected override bool StartTest()
        {
            logger.FlushLogBuffer();
            logoStr = "";
            if (AnalysisInputParameters(inputParameters) == false)
            {
                logger.FlushLogBuffer();
                return(false);
            }
            if (selectedEquipList["DUT"] != null && selectedEquipList["ATTEN"] != null && selectedEquipList["POWERSUPPLY"] != null)
            {
                Powersupply tempps    = (Powersupply)selectedEquipList["POWERSUPPLY"];
                Attennuator tempAtten = (Attennuator)selectedEquipList["ATTEN"];
                // 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(500);
                    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
                logoStr += logger.AdapterLogString(0, "Step3...Start Test RxDmi");
                double[] tempRxPowerDmiArray = new double[testRxPowerDmiStruct.ArrayListRxInputPower.Count];
                double[] tempRxPowerErrArray = new double[testRxPowerDmiStruct.ArrayListRxInputPower.Count];
                for (byte i = 0; i < testRxPowerDmiStruct.ArrayListRxInputPower.Count; i++)
                {
                    tempAtten.AttnValue(testRxPowerDmiStruct.ArrayListRxInputPower[i].ToString());
                    Thread.Sleep(1000);
                    tempRxPowerDmiArray[i] = dut.ReadDmiRxp();
                    tempRxPowerErrArray[i] = Math.Abs(Convert.ToDouble(testRxPowerDmiStruct.ArrayListRxInputPower[i].ToString()) - tempRxPowerDmiArray[i]);
                    logoStr += logger.AdapterLogString(1, "testRxPowerDmiStruct.ArrayListRxInputPower[" + i.ToString() + "]:" + testRxPowerDmiStruct.ArrayListRxInputPower[i].ToString() + "tempRxPowerDmiArray[" + i.ToString() + "]:" + tempRxPowerDmiArray[i].ToString() + "tempRxPowerErrArray[" + i.ToString() + "]" + tempRxPowerErrArray[i].ToString());
                }
                byte maxIndex;
                MaxErr      = algorithm.SelectMaxValue(ArrayList.Adapter(tempRxPowerErrArray), out maxIndex);
                ErrMaxPoint = Convert.ToDouble(testRxPowerDmiStruct.ArrayListRxInputPower[maxIndex].ToString());
                logoStr    += logger.AdapterLogString(1, "ErrMaxPoint=" + ErrMaxPoint.ToString() + "  MaxErr" + MaxErr.ToString());
                AnalysisOutputParameters(outputParameters);
                logger.FlushLogBuffer();
                return(true);
            }
            else
            {
                logoStr += logger.AdapterLogString(4, "Equipments is not enough!");
                logger.FlushLogBuffer();
                return(false);
            }
        }
Пример #18
0
        protected override bool StartTest()
        {
            logger.FlushLogBuffer();
            logoStr = "";
            IList <string> tempKeys = realTempratureArray.Keys;

            for (byte i = 0; i < tempKeys.Count; i++)
            {
                if (tempKeys[i].ToUpper().Substring(0, tempKeys[i].ToUpper().Length - 1) == (GlobalParameters.CurrentTemp.ToString().Trim().ToUpper()))
                {
                    logger.AdapterLogString(0, "Current temprature had exist");
                    return(true);
                }
            }


            if (AnalysisInputParameters(inputParameters) == false)
            {
                return(false);
            }
            if (selectedEquipList["DUT"] != null && selectedEquipList["POWERSUPPLY"] != null)
            {
                bool        isWriteCoefCOk = false;
                bool        isWriteCoefBOk = false;
                bool        isWriteCoefAOk = false;
                Powersupply tempps         = (Powersupply)selectedEquipList["POWERSUPPLY"];
                // close apc
                string apcstring = null;
                dut.APCStatus(out apcstring);
                if (apcstring == "ON" || apcstring == "FF")
                {
                    logoStr += logger.AdapterLogString(0, "Step2...Start close apc");
                    dut.APCOFF();
                    logoStr += logger.AdapterLogString(0, "Power off");
                    tempps.Switch(false);
                    Thread.Sleep(200);
                    logoStr += logger.AdapterLogString(0, "Power on");
                    tempps.Switch(true);
                    Thread.Sleep(500);
                    bool isclosed = dut.APCStatus(out apcstring);
                    if (apcstring == "OFF")
                    {
                        logoStr += logger.AdapterLogString(1, "APC OFF");
                    }
                    else
                    {
                        logoStr += logger.AdapterLogString(3, "APC NOT OFF");
                    }
                }
                // close apc
                #region  CheckTempChange

                if (!realTempratureArray.ContainsKey(GlobalParameters.CurrentTemp.ToString().Trim().ToUpper()))
                {
                    logoStr += logger.AdapterLogString(0, "Step3...TempChanged Read tempratureADC");
                    for (byte i = 0; i < GlobalParameters.TotalTempCount; i++)
                    {
                        realTempratureArray.Add(GlobalParameters.CurrentTemp.ToString().Trim().ToUpper() + i.ToString().ToUpper().Trim(), GlobalParameters.CurrentTemp.ToString().Trim());
                        logoStr += logger.AdapterLogString(1, "realtemprature=" + i.ToString() + GlobalParameters.CurrentTemp.ToString());
                        UInt16 tempratureADC;
                        dut.ReadTempADC(out tempratureADC, (byte)(i + 1));
                        logoStr += logger.AdapterLogString(1, "tempratureADC" + i.ToString() + tempratureADC.ToString());
                        tempratureADCArray.Add(GlobalParameters.CurrentTemp.ToString().Trim().ToUpper() + i.ToString().ToUpper().Trim(), tempratureADC.ToString().Trim());
                    }
                }
                #endregion
                int tempCount = 0;
                tempCount = Math.Min(tempratureADCArray.Count / GlobalParameters.TotalTempCount, realTempratureArray.Count / GlobalParameters.TotalTempCount);
                double[,] tempTempAdcArray   = new double[GlobalParameters.TotalTempCount, tempCount];
                double[,] tempTempValueArray = new double[GlobalParameters.TotalTempCount, tempCount];
                logoStr += logger.AdapterLogString(0, "Step4...Start Fitting Curve");
                if (tempCount >= 2)
                {
                    for (byte i = 0; i < GlobalParameters.TotalTempCount; i++)
                    {
                        int tempcount1 = 0;
                        for (byte j = 0; j < Math.Min(realTempratureArray.Count, tempratureADCArray.Count); j++)
                        {
                            int    tempstr2   = tempratureADCArray.Keys[j].ToUpper().Length;
                            string tempstring = tempratureADCArray.Keys[j].ToUpper().Substring(tempratureADCArray.Keys[j].ToUpper().Length - 1, 1);
                            string iStr       = i.ToString().ToUpper().Trim();
                            if (tempstring == iStr)
                            {
                                tempTempAdcArray[i, tempcount1]   = double.Parse(tempratureADCArray.Values[j]);
                                tempTempValueArray[i, tempcount1] = double.Parse(realTempratureArray.Values[j]);
                                tempcount1++;
                            }
                        }
                    }
                    for (byte i = 0; i < GlobalParameters.TotalTempCount; i++)
                    {
                        for (byte j = 0; j < tempCount; j++)
                        {
                            tempTempValueArray[i, j] = tempTempValueArray[i, j] * 256;
                        }
                    }
                    double[] adcArray  = new double[tempCount];
                    double[] realArray = new double[tempCount];
                    if (calTempDmiStruct.is1Stor2StorPid == 2)
                    {
                        for (byte i = 0; i < GlobalParameters.TotalTempCount; i++)
                        {
                            for (byte j = 0; j < tempCount; j++)
                            {
                                adcArray[j]  = tempTempAdcArray[i, j];
                                realArray[j] = tempTempValueArray[i, j];
                            }
                            double[] coefArray = algorithm.MultiLine(adcArray, realArray, tempCount, 2);
                            tempDmiCoefC = (float)coefArray[0];
                            tempDmiCoefB = (float)coefArray[1];
                            tempDmiCoefA = (float)coefArray[2];

                            tempDmiCoefArray = ArrayList.Adapter(coefArray);
                            tempDmiCoefArray.Reverse();
                            for (byte k = 0; k < tempDmiCoefArray.Count; k++)
                            {
                                logoStr += logger.AdapterLogString(1, "tempDmiCoefArray[" + k.ToString() + "]=" + tempDmiCoefArray[k].ToString() + " " + algorithm.ByteArraytoString(2, ",", algorithm.INT16To2Bytes(tempDmiCoefArray[k])));
                            }
                            logoStr += logger.AdapterLogString(0, "Step5...WriteCoef");
                            #region W&R Tempcoefc
                            isWriteCoefCOk = dut.SetTempcoefc(tempDmiCoefC.ToString(), (byte)(i + 1));
                            if (isWriteCoefCOk)
                            {
                                isWriteCoefCOk = true;
                                logoStr       += logger.AdapterLogString(1, "WritetempDmiCoefC:" + isWriteCoefCOk.ToString());
                            }
                            else
                            {
                                isWriteCoefCOk = false;
                                logoStr       += logger.AdapterLogString(3, "WritetempDmiCoefC:" + isWriteCoefCOk.ToString());
                            }
                            #endregion
                            #region W&R Tempcoefb
                            isWriteCoefBOk = dut.SetTempcoefb(tempDmiCoefB.ToString(), (byte)(i + 1));
                            if (isWriteCoefBOk)
                            {
                                isWriteCoefBOk = true;
                                logoStr       += logger.AdapterLogString(1, "WritetempDmiCoefB:" + isWriteCoefBOk.ToString());
                            }
                            else
                            {
                                isWriteCoefBOk = false;
                                logoStr       += logger.AdapterLogString(3, "WritetempDmiCoefB:" + isWriteCoefBOk.ToString());
                            }
                            #endregion
                            #region W&R Tempcoefa
                            //isWriteCoefAOk = dut.SetTempcoefa(tempDmiCoefA.ToString(), i + 1);
                            if (isWriteCoefAOk)
                            {
                                isWriteCoefAOk = true;
                                logoStr       += logger.AdapterLogString(1, "WritetempDmiCoefA:" + isWriteCoefAOk.ToString());
                            }
                            else
                            {
                                isWriteCoefAOk = false;
                                logoStr       += logger.AdapterLogString(3, "WritetempDmiCoefA:" + isWriteCoefAOk.ToString());
                            }
                            #endregion
                            if (isWriteCoefAOk & isWriteCoefBOk & isWriteCoefCOk)
                            {
                                isCalTempDmiOk = true;
                                logoStr       += logger.AdapterLogString(1, "isCalTempDmiOk:" + isCalTempDmiOk.ToString());
                            }
                            else
                            {
                                isCalTempDmiOk = false;
                                logoStr       += logger.AdapterLogString(3, "isCalTempDmiOk:" + isCalTempDmiOk.ToString());
                            }
                        }
                    }
                    else if (calTempDmiStruct.is1Stor2StorPid == 1)
                    {
                        for (byte i = 0; i < GlobalParameters.TotalTempCount; i++)
                        {
                            for (byte j = 0; j < tempCount; j++)
                            {
                                adcArray[j]  = tempTempAdcArray[i, j];
                                realArray[j] = tempTempValueArray[i, j];
                            }
                            double[] coefArray = algorithm.MultiLine(adcArray, realArray, tempCount, 1);
                            tempDmiCoefC = (float)coefArray[0];
                            tempDmiCoefB = (float)coefArray[1];
                            double[] tempCoefArray = new double[2] {
                                tempDmiCoefC, tempDmiCoefB
                            };

                            tempDmiCoefArray = ArrayList.Adapter(tempCoefArray);
                            tempDmiCoefArray.Reverse();
                            for (byte k = 0; k < tempDmiCoefArray.Count; k++)
                            {
                                logoStr += logger.AdapterLogString(1, "tempDmiCoefArray[" + k.ToString() + "]=" + tempDmiCoefArray[k].ToString() + " " + algorithm.ByteArraytoString(2, ",", algorithm.INT16To2Bytes(tempDmiCoefArray[k])));
                            }
                            logoStr += logger.AdapterLogString(0, "Step5...WriteCoef");

                            #region W&R Tempcoefc
                            isWriteCoefCOk = dut.SetTempcoefc(tempDmiCoefC.ToString(), (byte)(i + 1));
                            if (isWriteCoefCOk)
                            {
                                isWriteCoefCOk = true;
                                logoStr       += logger.AdapterLogString(1, "WritetempDmiCoefC:" + isWriteCoefCOk.ToString());
                            }
                            else
                            {
                                isWriteCoefCOk = false;
                                logoStr       += logger.AdapterLogString(3, "WritetempDmiCoefC:" + isWriteCoefCOk.ToString());
                            }
                            #endregion
                            #region W&R Tempcoefb
                            isWriteCoefBOk = dut.SetTempcoefb(tempDmiCoefB.ToString(), (byte)(i + 1));
                            if (isWriteCoefBOk)
                            {
                                isWriteCoefBOk = true;
                                logoStr       += logger.AdapterLogString(1, "WritetempDmiCoefB:" + isWriteCoefBOk.ToString());
                            }
                            else
                            {
                                isWriteCoefBOk = false;
                                logoStr       += logger.AdapterLogString(3, "WritetempDmiCoefB:" + isWriteCoefBOk.ToString());
                            }
                            #endregion
                            if (isWriteCoefBOk & isWriteCoefCOk)
                            {
                                isCalTempDmiOk = true;
                                logoStr       += logger.AdapterLogString(1, "isCalTempDmiOk:" + isCalTempDmiOk.ToString());
                            }
                            else
                            {
                                isCalTempDmiOk = false;
                                logoStr       += logger.AdapterLogString(3, "isCalTempDmiOk:" + isCalTempDmiOk.ToString());
                            }
                        }
                    }
                }
                else
                {
                    logoStr       += logger.AdapterLogString(0, "TempCount<2:");
                    isCalTempDmiOk = true;
                }
            }
            else
            {
                logoStr       += logger.AdapterLogString(4, "Equipments is not enough!");
                isCalTempDmiOk = false;
                logger.FlushLogBuffer();
                return(isCalTempDmiOk);
            }
            AnalysisOutputParameters(outputParameters);
            logger.FlushLogBuffer();
            return(isCalTempDmiOk);
        }
Пример #19
0
 protected override bool StartTest()
 {
     logger.FlushLogBuffer();
     logoStr = "";
     if (AnalysisInputParameters(inputParameters) == false)
     {
         logger.FlushLogBuffer();
         return(false);
     }
     if (PrepareEnvironment(selectedEquipList) == false)
     {
         logger.FlushLogBuffer();
         return(false);
     }
     if (selectedEquipList["SCOPE"] != null && selectedEquipList["DUT"] != null && selectedEquipList["POWERSUPPLY"] != null)
     {
         Powersupply tempps    = (Powersupply)selectedEquipList["POWERSUPPLY"];
         Scope       tempScope = (Scope)selectedEquipList["SCOPE"];
         // 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
         logoStr      += logger.AdapterLogString(0, "Step3...Read DCA TxPower");
         txDCAPowerDmi = tempScope.GetAveragePowerdbm();
         logoStr      += logger.AdapterLogString(1, "txDCAPowerDmi:" + txDCAPowerDmi.ToString());
         logoStr      += logger.AdapterLogString(0, "Step4...Read DUT Txpower");
         txPowerDmi    = dut.ReadDmiTxp();
         logoStr      += logger.AdapterLogString(1, "txPowerDmi:" + txPowerDmi.ToString());
         txDmiPowerErr = txPowerDmi - txDCAPowerDmi;
         logoStr      += logger.AdapterLogString(1, "txDmiPowerErr:" + txDmiPowerErr.ToString());
         AnalysisOutputParameters(outputParameters);
         logger.FlushLogBuffer();
         return(true);
     }
     else
     {
         logoStr += logger.AdapterLogString(4, "Equipments is not enough!");
         logger.FlushLogBuffer();
         return(false);
     }
 }
Пример #20
0
        public override bool SelectEquipment(EquipmentList aEquipList)
        {
            selectedEquipList.Clear();
            if (aEquipList.Count == 0)
            {
                return(false);
            }
            else
            {
                bool isOK = false;
                selectedEquipList.Clear();
                IList <string>        tempKeys   = aEquipList.Keys;
                IList <EquipmentBase> tempValues = aEquipList.Values;
                for (byte i = 0; i < aEquipList.Count; i++)
                {
                    if (tempKeys[i].ToUpper().Contains("ERRORDETE"))

                    {
                        selectedEquipList.Add("ERRORDETE", tempValues[i]);
                    }
                    if (tempKeys[i].ToUpper().Contains("ATTEN"))

                    {
                        selectedEquipList.Add("ATTEN", tempValues[i]);
                    }
                    if (tempKeys[i].ToUpper().Contains("POWERSUPPLY"))
                    {
                        selectedEquipList.Add("POWERSUPPLY", tempValues[i]);
                    }
                    if (tempKeys[i].ToUpper().Contains("NA_OPTICALSWITCH"))
                    {
                        tempValues[i].CheckEquipmentRole(2, GlobalParameters.CurrentChannel);
                    }
                }
                tempAtten = (Attennuator)selectedEquipList["ATTEN"];
                tempED    = (ErrorDetector)selectedEquipList["ERRORDETE"];
                tempps    = (Powersupply)selectedEquipList["POWERSUPPLY"];
                if (tempAtten != null && tempED != null && tempps != null)
                {
                    isOK = true;
                }
                else
                {
                    if (tempED == null)
                    {
                        Log.SaveLogToTxt("ERRORDETE =NULL");
                    }
                    if (tempAtten == null)
                    {
                        Log.SaveLogToTxt("ATTEN =NULL");
                    }
                    if (tempps == null)
                    {
                        Log.SaveLogToTxt("POWERSUPPLY =NULL");
                    }
                    isOK = false;
                    OutPutandFlushLog();
                    isOK = false;
                }
                if (isOK)
                {
                    selectedEquipList.Add("DUT", dut);
                }
                else
                {
                    isOK = false;
                }
                return(isOK);
            }
        }
Пример #21
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);
            }
        }
Пример #22
0
        protected override bool StartTest()
        {
            logger.FlushLogBuffer();
            logoStr = "";
            if (AnalysisInputParameters(inputParameters) == false)
            {
                logger.FlushLogBuffer();
                return(false);
            }

            if (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(1, "APC NOT ON");
                    }
                }
                // open apc
                //temp
                logoStr += logger.AdapterLogString(0, "Step3...CheckTempHighAlarm");
                logoStr += logger.AdapterLogString(1, CheckTempHighAlarm(dut).ToString());

                logoStr += logger.AdapterLogString(0, "Step4...CheckTempHighWarning");
                logoStr += logger.AdapterLogString(1, CheckTempHighWarning(dut).ToString());

                logoStr += logger.AdapterLogString(0, "Step5...CheckTempLowAlarm");
                logoStr += logger.AdapterLogString(1, CheckTempLowAlarm(dut).ToString());

                logoStr += logger.AdapterLogString(0, "Step6...CheckTempLowWarning");
                logoStr += logger.AdapterLogString(1, CheckTempLowWarning(dut).ToString());



                //vcc
                logoStr += logger.AdapterLogString(0, "Step7...CheckVccLowWarning");
                logoStr += logger.AdapterLogString(1, CheckVccLowWarning(dut).ToString());

                logoStr += logger.AdapterLogString(0, "Step8...CheckVccLowAlarm");
                logoStr += logger.AdapterLogString(1, CheckVccLowAlarm(dut).ToString());

                logoStr += logger.AdapterLogString(0, "Step9...CheckVccHighAlarm");
                logoStr += logger.AdapterLogString(1, CheckVccHighAlarm(dut).ToString());


                logoStr += logger.AdapterLogString(0, "Step10...CheckVccHighWarning");
                logoStr += logger.AdapterLogString(1, CheckVccHighWarning(dut).ToString());



                //ibias
                logoStr += logger.AdapterLogString(0, "Step11...CheckBiasHighAlarm");
                logoStr += logger.AdapterLogString(1, CheckBiasHighAlarm(dut).ToString());

                logoStr += logger.AdapterLogString(0, "Step12...CheckBiasHighWarning");
                logoStr += logger.AdapterLogString(1, CheckBiasHighWarning(dut).ToString());

                logoStr += logger.AdapterLogString(0, "Step13...CheckBiasLowWarning");
                logoStr += logger.AdapterLogString(1, CheckBiasLowWarning(dut).ToString());

                logoStr += logger.AdapterLogString(0, "Step14...CheckBiasLowAlarm");
                logoStr += logger.AdapterLogString(1, CheckBiasLowAlarm(dut).ToString());

                // tx power
                logoStr += logger.AdapterLogString(0, "Step15...CheckTxPowerHighAlarm");
                logoStr += logger.AdapterLogString(1, CheckTxPowerHighAlarm(dut).ToString());

                logoStr += logger.AdapterLogString(0, "Step16...CheckTxPowerHighWarning");
                logoStr += logger.AdapterLogString(1, CheckTxPowerHighWarning(dut).ToString());

                logoStr += logger.AdapterLogString(0, "Step17...CheckTxPowerLowWarning");
                logoStr += logger.AdapterLogString(1, CheckTxPowerLowWarning(dut).ToString());

                logoStr += logger.AdapterLogString(0, "Step18...CheckTxPowerLowAlarm");
                logoStr += logger.AdapterLogString(1, CheckTxPowerLowAlarm(dut).ToString());



                // rx power
                logoStr += logger.AdapterLogString(0, "Step19...CheckRxPowerHighAlarm");
                logoStr += logger.AdapterLogString(1, CheckRxPowerHighAlarm(dut).ToString());

                logoStr += logger.AdapterLogString(0, "Step20...CheckRxPowerHighWarning");
                logoStr += logger.AdapterLogString(1, CheckRxPowerHighWarning(dut).ToString());

                logoStr += logger.AdapterLogString(0, "Step21...CheckRxPowerLowWarning");
                logoStr += logger.AdapterLogString(1, CheckRxPowerLowWarning(dut).ToString());

                logoStr += logger.AdapterLogString(0, "Step22...CheckRxPowerLowAlarm");
                logoStr += logger.AdapterLogString(1, CheckRxPowerLowAlarm(dut).ToString());



                AnalysisOutputParameters(outputParameters);
                logger.FlushLogBuffer();
                return(true);
            }

            else
            {
                logoStr += logger.AdapterLogString(4, "Equipments is not enough!");
                logger.FlushLogBuffer();
                return(false);
            }
        }
Пример #23
0
 public override bool SelectEquipment(EquipmentList aEquipList)
 {
     selectedEquipList.Clear();
     try
     {
         if (aEquipList.Count == 0)
         {
             return(false);
         }
         else
         {
             bool isOK = false;
             selectedEquipList.Clear();
             IList <string>        tempKeys   = aEquipList.Keys;
             IList <EquipmentBase> tempValues = aEquipList.Values;
             for (byte i = 0; i < aEquipList.Count; i++)
             {
                 if (tempKeys[i].ToUpper().Contains("POWERSUPPLY"))
                 {
                     selectedEquipList.Add("POWERSUPPLY", tempValues[i]);
                     isOK = true;
                 }
             }
             tempps = (Powersupply)selectedEquipList["POWERSUPPLY"];
             if (tempps != null)
             {
                 isOK = true;
             }
             else
             {
                 if (tempps == null)
                 {
                     Log.SaveLogToTxt("POWERSUPPLY =NULL");
                 }
                 isOK = false;
                 OutPutandFlushLog();
                 isOK = false;
             }
             if (isOK)
             {
                 selectedEquipList.Add("DUT", dut);
                 return(isOK);
             }
             return(isOK);
         }
     }
     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._0x02F00, 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._0x02F00, error.StackTrace);
     }
 }