示例#1
0
        public Dictionary <string, double> BeginTest(DUT dut, Dictionary <string, IEquipment> equipments, Dictionary <string, string> inPara)
        {
            try
            {
                PowerSupply supply = (PowerSupply)equipments["POWERSUPPLY"];
                Log.SaveLogToTxt("Start to do DMI_VCC test");
                Log.SaveLogToTxt("Try to get woltage of powersupply");
                double voltage = supply.GetVoltage();
                Log.SaveLogToTxt("Get VCC is " + voltage.ToString("f3"));
                Log.SaveLogToTxt("Try to read DmiVcc of DUT");
                double delta = dut.ReadDmiVcc() - ConditionParaByTestPlan.VCC;
                Log.SaveLogToTxt("Calculate delta of VCC is " + delta.ToString("f3"));
                Log.SaveLogToTxt("End DMI_VCC test" + "\r\n");

                //save testdata
                Dictionary <string, double> dictionary = new Dictionary <string, double>();
                dictionary.Add("DmiVccErr", delta);
                dictionary.Add("Result", 1);
                return(dictionary);
            }
            catch
            {
                Log.SaveLogToTxt("Failed DMI_VCC test.");
                return(null);
            }
        }
示例#2
0
 public Dictionary <string, double> BeginTest(DUT dut, Dictionary <string, IEquipment> equipments, Dictionary <string, string> inPara)
 {
     try
     {
         PowerSupply supply = (PowerSupply)equipments["POWERSUPPLY"];
         Log.SaveLogToTxt("Start to do DMI_ICC test");
         Log.SaveLogToTxt("Try to get current of powersupply");
         double current = supply.GetCurrent();
         Log.SaveLogToTxt("Get ICC is " + current.ToString("f3"));
         Log.SaveLogToTxt("End DMI_ICC test" + "\r\n");
         //save testdata
         Dictionary <string, double> dictionary = new Dictionary <string, double>();
         dictionary.Add("Current", current);
         dictionary.Add("Result", 1);
         return(dictionary);
     }
     catch
     {
         Log.SaveLogToTxt("Failed DMI_ICC test.");
         return(null);
     }
 }
示例#3
0
        public bool ReadyForTest(out string dut_SN, out string dut_FW)
        {
            dut_SN = "";
            dut_FW = "";
            string TestStartTime = myDataIO.GetCurrTime().ToString("yyyy/MM/dd HH:mm:ss");

            try
            {
                supply      = null;
                tempControl = null;
                attennuator = null;
                foreach (string key in usedEquipments.Keys)
                {
                    if (key == "POWERSUPPLY")
                    {
                        supply = (PowerSupply)this.usedEquipments[key];
                    }

                    if (key == "THERMOCONTROLLER")
                    {
                        tempControl = (Thermocontroller)this.usedEquipments[key];
                    }

                    if (key == "ATTENNUATOR")
                    {
                        attennuator = (Attennuator)this.usedEquipments[key];
                    }
                }

                // 获得芯片control 地址信息
                Log.SaveLogToTxt("Try to get chip control address from server.");
                string          table      = "GlobalManufactureChipsetControl";
                string          expression = "select * from " + table + " where PID= " + GlobalParaByPN.ID + " order by ID";
                ChipControlByPN dataTable_ChipControlByPN = new ChipControlByPN(myDataIO.GetDataTable(expression, table));

                // 获得芯片初始化赋值信息
                Log.SaveLogToTxt("Try to get chip default value from server.");
                table      = "GlobalManufactureChipsetInitialize";
                expression = "select * from " + table + " where PID= " + GlobalParaByPN.ID + " order by ID";
                ChipDefaultValueByPN dataTable_ChipDefaultValueByPN = new ChipDefaultValueByPN(myDataIO.GetDataTable(expression, table));

                // 获得模块配置EEPROM初始化赋值信息
                Log.SaveLogToTxt("Try to get EEPROM default value from server.");
                table      = "TopoManufactureConfigInit";
                expression = "select * from " + table + " where PID= " + TestPlanParaByPN.ID + " order by ID";
                EEPROMDefaultValueByTestPlan dataTable_EEPROMDefaultValueByTestPlan = new EEPROMDefaultValueByTestPlan(myDataIO.GetDataTable(expression, table));

                // 获得模块系数表信息
                Log.SaveLogToTxt("Try to get module map from server.");
                table      = "GlobalManufactureCoefficients";
                expression = "select * from " + table + " where PID= " + GlobalParaByPN.MCoefsID + " order by ID";
                DUTCoeffControlByPN dataTable_DUTCoeffControlByPN = new DUTCoeffControlByPN(myDataIO.GetDataTable(expression, table));

                dut = myFactory.CreateDUT(GlobalParaByPN.Family);
                dut.Initial(dataTable_ChipControlByPN, dataTable_ChipDefaultValueByPN, dataTable_EEPROMDefaultValueByTestPlan, dataTable_DUTCoeffControlByPN);

                Log.SaveLogToTxt("Enable full function of module.");
                supply.OutPutSwitch(true);
                if (!dut.FullFunctionEnable())
                {
                    Log.SaveLogToTxt("Faield to enable full function of module.");
                    return(false);
                }

                //check SN
                for (int i = 0; i < 3; i++)
                {
                    dut_SN = dut.ReadSN();

                    if (Algorithm.CheckSerialNumberFormat(dut_SN))
                    {
                        Log.SaveLogToTxt("Read module' serial number is " + dut_SN);
                        break;
                    }

                    if (i == 2)
                    {
                        Log.SaveLogToTxt("Failed to read module' serial number.");
                        return(false);
                    }
                }

                //check FW
                for (int i = 0; i < 3; i++)
                {
                    dut_FW = dut.ReadFW();

                    if (dut_FW.Length != 4)
                    {
                        Log.SaveLogToTxt("Failed to read module's firmware.");
                        return(false);
                    }

                    if (dut_FW != "0000" && dut_FW != "FFFF")
                    {
                        if (TestPlanParaByPN.IsCheckFW)
                        {
                            if (dut_FW != TestPlanParaByPN.FwVersion)
                            {
                                Log.SaveLogToTxt("Module's firmware does not math.");
                                break;
                            }
                        }
                        break;
                    }
                }

                return(true);
            }
            catch
            {
                Log.SaveLogToTxt("Failed to prepare to test. Please check network.");
                return(false);
            }
        }
示例#4
0
        public Dictionary <string, double> BeginTest(DUT dut, Dictionary <string, IEquipment> equipments, Dictionary <string, string> inPara)
        {
            try
            {
                //get the current test channel
                int channel = ConditionParaByTestPlan.Channel;
                Log.SaveLogToTxt("Start to do quick check test for channel " + channel);
                //get equipment object
                PowerSupply   supply        = (PowerSupply)equipments["POWERSUPPLY"];
                Attennuator   attennuator   = (Attennuator)equipments["ATTENNUATOR"];
                OpticalSwitch opticalSwitch = (OpticalSwitch)equipments["OPTICALSWITCH"];
                PowerMeter    powerMeter    = (PowerMeter)equipments["POWERMETER"];
                //get in parameters
                string[] BiasDACs   = inPara["BIASDACS"].Split(',');
                string[] ModDACs    = inPara["MODDACS"].Split(',');
                double   ratio      = Convert.ToDouble(inPara["RATIO"]);
                double   U_Ref      = Convert.ToDouble(inPara["UREF"]);
                double   resolution = Convert.ToDouble(inPara["RESOLUTION"]);
                double   R_rssi     = Convert.ToDouble(inPara["RRSSI"]);

                //read current of power supply
                double current = supply.GetCurrent();

                // close apc
                Log.SaveLogToTxt("Close apc for module.");
                dut.CloseAndOpenAPC(Convert.ToByte(DUT.APCMODE.IBAISandIMODOFF));

                //disable attennuator and Tx to read Rx/TxDarkADC
                Log.SaveLogToTxt("Shut down attennuator and disable Tx to read Tx/RxDark ADC for channel " + channel);
                attennuator.OutPutSwitch(false);
                ushort RxDarkADC = dut.ReadADC(DUT.NameOfADC.RXPOWERADC, channel);
                dut.SetSoftTxDis();
                ushort TxDarkADC = dut.ReadADC(DUT.NameOfADC.TXPOWERADC, channel);
                Log.SaveLogToTxt("TxDarkADC is " + TxDarkADC);
                Log.SaveLogToTxt("RxDarkADC is " + RxDarkADC);

                //enable attennuator and Tx
                Log.SaveLogToTxt("Power on attennuator and set value to 0");
                attennuator.OutPutSwitch(true);
                attennuator.SetAttnValue(0);
                Log.SaveLogToTxt("Light on all Tx channel.");
                dut.TxAllChannelEnable();

                ConfigXmlIO myXml = new ConfigXmlIO(FilePath.ConfigXml);
                //get scope/powermeter's offset
                string[] offsetArray = myXml.ScopeOffset.Split(',');
                double   offset      = Convert.ToDouble(offsetArray[channel - 1]);
                //get attenator's ofset
                string[] lightSourceArray = myXml.AttennuatorOffset.Split(',');
                double   lightSource      = Convert.ToDouble(lightSourceArray[channel - 1]);
                //calculate RxRes
                double RxRes = dut.CalRxRes(lightSource, channel, ratio, U_Ref, resolution, R_rssi);
                Log.SaveLogToTxt("Calculate RES of Rx is " + RxRes.ToString("f3"));

                //set default Bias/ModDAC
                Log.SaveLogToTxt("Set BiasDAC is " + BiasDACs[channel - 1]);
                Log.SaveLogToTxt("Set ModDAC is " + ModDACs[channel - 1]);
                dut.WriteChipDAC(DUT.NameOfChipDAC.BIASDAC, channel, BiasDACs[channel - 1]);
                dut.WriteChipDAC(DUT.NameOfChipDAC.MODDAC, channel, ModDACs[channel - 1]);
                //change to related change, and read Tx power
                opticalSwitch.ChangeChannel(channel);
                double TxP = powerMeter.ReadPower(channel) + offset;
                Log.SaveLogToTxt("Get Tx power is " + TxP.ToString("f3"));

                //read SN again and check its format
                string dut_SN = dut.ReadSN();
                if (!Algorithm.CheckSerialNumberFormat(dut_SN))
                {
                    Log.SaveLogToTxt("Module' serial number is not correct");
                    return(null);
                }

                Log.SaveLogToTxt("Again. Read module' serial number is " + dut_SN);

                //save test data to TestData class
                DataRow dr = testData.NewRow();
                dr["Family"]         = GlobalParaByPN.Family;
                dr["PartNumber"]     = GlobalParaByPN.PN;
                dr["SerialNumber"]   = dut_SN;
                dr["Channel"]        = channel;
                dr["Current"]        = current.ToString("f3");
                dr["Temp"]           = ConditionParaByTestPlan.Temp;
                dr["Station"]        = GlobalParaByPN.Station;
                dr["Time"]           = DateTime.Now;
                dr["TxDarkADC"]      = TxDarkADC;
                dr["TxPower"]        = TxP.ToString("f3");
                dr["RxDarkADC"]      = RxDarkADC;
                dr["RxRes"]          = RxRes.ToString("f3");
                dr["DeltaTxDarkADC"] = -99999;
                dr["DeltaTxPower"]   = "-99999";
                dr["DeltaRxDarkADC"] = -99999;
                dr["DeltaRxRes"]     = "-99999";
                dr["Result"]         = -1;

                if (GlobalParaByPN.Station == "PreModule")
                {
                    dr["Result"] = 0;
                }
                else
                {
                    Log.SaveLogToTxt("Try to get test data of pre module station to calculate delta.");
                    //conect to mysql database to get test recording of pre module station
                    string          mysqlconCommand = "Database=my_databases;Data Source=localhost;User Id=root;Password=abc@123;pooling=false;CharSet=utf8;port=3306";
                    MySqlConnection mycon           = new MySqlConnection();
                    mycon.ConnectionString = mysqlconCommand;
                    mycon.Open();

                    string table      = "my_databases.quickcheck_testdata";
                    string experisson = "SELECT * FROM my_databases.quickcheck_testdata where PartNumber = '" + GlobalParaByPN.PN + "' and Serialnumber = '" +
                                        dut_SN + "' and Channel = " + channel + " and Temp = " + ConditionParaByTestPlan.Temp + " and Station = 'PreModule' order by ID";

                    MySqlDataAdapter    da = new MySqlDataAdapter(experisson, mycon);
                    MySqlCommandBuilder cb = new MySqlCommandBuilder(da);
                    DataSet             ds = new DataSet(table);
                    da.Fill(ds, table);
                    DataTable dt = ds.Tables[table];
                    mycon.Close();

                    if (dt.Rows.Count != 0)
                    {
                        //calculate delta: post - pre
                        dr["DeltaTxDarkADC"] = Convert.ToInt32(dr["TxDarkADC"]) - Convert.ToInt32(dt.Rows[dt.Rows.Count - 1]["TxDarkADC"]);
                        dr["DeltaTxPower"]   = (Convert.ToDouble(dr["TxPower"]) - Convert.ToDouble(dt.Rows[dt.Rows.Count - 1]["TxPower"])).ToString("f3");
                        dr["DeltaRxDarkADC"] = Convert.ToInt32(dr["RxDarkADC"]) - Convert.ToInt32(dt.Rows[dt.Rows.Count - 1]["RxDarkADC"]);
                        double orgRxRes = Convert.ToDouble(dt.Rows[dt.Rows.Count - 1]["RxRes"]);
                        //orgRxRes can't be zero
                        dr["DeltaRxRes"] = (orgRxRes == 0) ? "-99999" : (100.0 * (Convert.ToDouble(dr["RxRes"]) - orgRxRes) / orgRxRes).ToString("f2") + "%";
                        dr["Result"]     = 0;
                        Log.SaveLogToTxt("Sucessfully get test data of pre module station.");
                        Log.SaveLogToTxt("DeltaTxDarkADC is " + dr["DeltaTxDarkADC"]);
                        Log.SaveLogToTxt("DeltaTxPower is " + dr["DeltaTxPower"]);
                        Log.SaveLogToTxt("DeltaRxDarkADC is " + dr["DeltaRxDarkADC"]);
                        Log.SaveLogToTxt("DeltaRxRes is " + dr["DeltaRxRes"]);
                    }
                    else
                    {
                        Log.SaveLogToTxt("Failed to get test data of pre module station.");
                        //return false;
                    }
                }
                testData.Rows.Add(dr);
                dr = null;
                Log.SaveLogToTxt("End quick check test for channel " + channel + "\r\n");

                //save testdata
                Dictionary <string, double> dic = new Dictionary <string, double>();
                dic.Add("Result", 1);
                return(dic);
            }
            catch
            {
                Log.SaveLogToTxt("Failed quickcheck test.");
                return(null);
            }
        }