public bool CloseandOpenAPC(byte mode) { bool isOK = false; if (GlobalParameters.APCType == Convert.ToByte(apctype.none)) { Log.SaveLogToTxt("no apc"); return(true); } try { switch (mode) { case (byte)APCMODE.IBAISandIMODON: { Log.SaveLogToTxt("Open apc"); isOK = dut.APCON(0x11); // isOK = dut.APCON(0x00); Log.SaveLogToTxt("Open apc" + isOK.ToString()); break; } case (byte)APCMODE.IBAISandIMODOFF: { Log.SaveLogToTxt(" Close apc"); isOK = dut.APCOFF(0x11); Log.SaveLogToTxt("Close apc" + isOK.ToString()); } break; case (byte)APCMODE.IBIASONandIMODOFF: { Log.SaveLogToTxt(" Close IModAPCand Open IBiasAPC"); isOK = dut.APCON(0x01); Log.SaveLogToTxt("Close IModAPCand Open IBiasAPC" + isOK.ToString()); break; } case (byte)APCMODE.IBIASOFFandIMODON: { Log.SaveLogToTxt(" Close IBiasAPCand Open IModAPC"); isOK = dut.APCON(0x10); Log.SaveLogToTxt("Close IBiasAPCand Open IModAPC" + isOK.ToString()); break; } default: { break; } } 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._0xFFFFF, error.StackTrace); //Log.SaveLogToTxt(ex.ID + ": " + ex.Message + "\r\n" + ex.StackTrace); exceptionList.Add(ex); return(false); //the other way is: should throw exception, rather than the above three code. see below: //throw new InnoExCeption(ExceptionDictionary.Code._0xFFFFF, error.StackTrace); } }
protected override bool AnalysisInputParameters(TestModeEquipmentParameters[] InformationList) { Log.SaveLogToTxt("Step1...Check InputParameters"); try { if (InformationList.Length < inPutParametersNameArray.Count) { Log.SaveLogToTxt("InputParameters are not enough!"); return(false); } else { int index = -1; bool isParametersComplete = true; if (isParametersComplete) { //for (byte i = 0; i < InformationList.Length; i++) { if (Algorithm.FindFileName(InformationList, "RxInputPower", out index)) { adjustAPDStruct.RxInputPower = Convert.ToDouble(InformationList[index].DefaultValue); } if (Algorithm.FindFileName(InformationList, "SETPOINTS", out index)) { char[] tempCharArray = new char[] { ',' }; ArrayList tempAL = Algorithm.StringtoArraylistDeletePunctuations(InformationList[index].DefaultValue, tempCharArray); if (tempAL == null) { Log.SaveLogToTxt(InformationList[index].FiledName + "is null"); return(false); } else { adjustAPDStruct.SetPoints = new Int32[tempAL.Count]; for (int i = 0; i < tempAL.Count; i++) { adjustAPDStruct.SetPoints[i] = Int32.Parse(tempAL[i].ToString()); } } } if (Algorithm.FindFileName(InformationList, "ScanCount", out index)) { adjustAPDStruct.ScanCount = Convert.ToByte(InformationList[index].DefaultValue); } if (Algorithm.FindFileName(InformationList, "Formula_X_Type", out index)) { adjustAPDStruct.Formula_X_Type = Convert.ToByte(InformationList[index].DefaultValue); } } } Log.SaveLogToTxt("OK!"); return(true); } } 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._0x02001, 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._0x02001, error.StackTrace); } }
public override bool Test() { try { ppg.ConfigurePatternType(2); ppg.DataPattern_DataLength(myStruct.Length.ToString()); ppg.DataPattern_SetPatternData("#H0", "#H" + (myStruct.Length - 1), "B" + myStruct.Data.ToString()); scope.SetMode(1); count++; DialogResult dialogResult; if (count == 1) { dialogResult = MessageBox.Show("Please unplug and plug DUT", "Infomation", MessageBoxButtons.OK); if (dialogResult != DialogResult.OK) { return(false); } } //scope.MyIO.WriteString(":TIMebase:PTImebase:STATe OFF"); //scope.MyIO.WriteString(":TRIGger:SOURce FPANel"); //scope.MyIO.WriteString(":TRIGger:PLOCK ON"); //scope.MyIO.WriteString("*OPC?"); scope.PtimebaseStatue(false); scope.TriggerSourceFpanel(); scope.TriggerPlock(true); Thread.Sleep(50); scope.AutoScale(); // scope.setcommand(":TIMebase:PTImebase:STATe OFF"); dialogResult = MessageBox.Show("Begin to test polarity?", "Infomation", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { scope.pglobalParameters = GlobalParameters; txPolarity = TestTxPolarity(); rxPolarity = TestRxPolarity(); } else { return(false); } if ((txPolarity <= mySpec.TxPolaritySpecMax && txPolarity >= mySpec.TxPolaritySpecMin) && (rxPolarity <= mySpec.RxPolaritySpecMax && rxPolarity >= mySpec.RxPolaritySpecMin)) { return(true); } else { return(false); } } catch (InnoExCeption ex)//from driver { //Log.SaveLogToTxt(ex.ID + ": " + ex.Message + "\r\n" + ex.StackTrace); exceptionList.Add(ex); return(false); } catch (Exception error)//from itself { //one way: deal this exception itself InnoExCeption ex = new InnoExCeption(ExceptionDictionary.Code._0xFFFFF, error.StackTrace); //Log.SaveLogToTxt(ex.ID + ": " + ex.Message + "\r\n" + ex.StackTrace); exceptionList.Add(ex); return(false); //the other way is: should throw exception, rather than the above three code. see below: //throw new InnoExCeption(ExceptionDictionary.Code._0xFFFFF, error.StackTrace); } }
protected byte SearchMaskPoint(Int32[] ScanArray, out double[] Item) { Item = new double[ScanArray.Length]; try { ArrayList StrLog = new ArrayList(); for (int i = 0; i < ScanArray.Length; i++) { dut.WriteMaskDac(ScanArray[i]); Thread.Sleep(200); Item[i] = GetMask(); StrLog.Add("ScanArray[" + i + "] =" + ScanArray[i].ToString() + " " + "Mask[" + i + "] =" + Item[i].ToString()); } for (int i = 0; i < StrLog.Count; i++) { Log.SaveLogToTxt(StrLog[i].ToString()); } byte bIndex; ArrayList TempArray = new ArrayList(); TempArray.Clear(); for (int i = 0; i < ScanArray.Length; i++) { TempArray.Add(Item[i]); } Algorithm.SelectMinValue(TempArray, out bIndex); Log.SaveLogToTxt("ScanMaskDAC =" + ScanArray[bIndex].ToString()); Log.SaveLogToTxt("ScanMask =" + Item[bIndex].ToString()); //Log.SaveLogToTxt("ErrorRate[" + bIndex + "] =" + TempValue); return(bIndex); } catch (InnoExCeption ex) //from driver { //Log.SaveLogToTxt(ex.ID + ": " + ex.Message + "\r\n" + ex.StackTrace); exceptionList.Add(ex); return(0); } catch (Exception error) //from itself { //one way: deal this exception itself InnoExCeption ex = new InnoExCeption(ExceptionDictionary.Code._0x02108, error.StackTrace); //Log.SaveLogToTxt(ex.ID + ": " + ex.Message + "\r\n" + ex.StackTrace); exceptionList.Add(ex); return(0); //the other way is: should throw exception, rather than the above three code. see below: //throw new InnoExCeption(ExceptionDictionary.Code._0x02108, error.StackTrace); } }
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); } }
protected bool OpticalTest() { lock (tempScope) { try { bool flagMask = false; apDBM = InnoExCeption.NaN; er = InnoExCeption.NaN; crossing = InnoExCeption.NaN; marginVaulue = InnoExCeption.NaN; jitterRMS = InnoExCeption.NaN; jitterPP = InnoExCeption.NaN; OEOMA = InnoExCeption.NaN; OEOMADBM = InnoExCeption.NaN; riseTime = InnoExCeption.NaN; fallTime = InnoExCeption.NaN; EyeHeight = InnoExCeption.NaN; bitRate = InnoExCeption.NaN; XmarginVaulue2 = InnoExCeption.NaN; //throw new InnoExCeption(ExceptionDictionary.Code._0x02000, "abc"); //int ni = 0; //int nj = 5 / ni; //Scope tempScope = (Scope)selectedEquipList["SCOPE"]; if (tempScope != null) { tempScope.pglobalParameters = GlobalParameters; double[] tempDoubleArray; //for (int K = 0; K < 4;K++ ) //{ if (!tempScope.OpticalEyeTest(out tempDoubleArray, 1)) { for (byte i = 0; i < tempDoubleArray.Length; i++) { tempDoubleArray[i] = InnoExCeption.NaN; } } if (tempDoubleArray[8] > MaskSpecMax || tempDoubleArray[8] < MaskSpecMin) { flagMask = false; } else { flagMask = true; } if (!flagMask)//后三次测试有一次失败就不在测试 { for (int k = 0; k < 3; k++) { if (!tempScope.OpticalEyeTest(out tempDoubleArray)) { for (byte i = 0; i < tempDoubleArray.Length; i++) { tempDoubleArray[i] = InnoExCeption.NaN; } } if (tempDoubleArray[8] > MaskSpecMax || tempDoubleArray[8] < MaskSpecMin) { break; } } } OEOMA = tempDoubleArray[2]; OEOMADBM = Algorithm.ChangeUwtoDbm(OEOMA * 1000); jitterRMS = tempDoubleArray[5]; jitterPP = tempDoubleArray[4]; riseTime = tempDoubleArray[6]; fallTime = tempDoubleArray[7]; crossing = tempDoubleArray[3]; er = tempDoubleArray[1]; apDBM = tempDoubleArray[0]; marginVaulue = tempDoubleArray[8]; EyeHeight = tempDoubleArray[9]; bitRate = tempDoubleArray[10]; XmarginVaulue2 = tempDoubleArray[11]; // EyeWidth = tempDoubleArray[10]; Log.SaveLogToTxt("apDBM:" + apDBM.ToString()); Log.SaveLogToTxt("er:" + er.ToString()); Log.SaveLogToTxt("crossing:" + crossing.ToString()); Log.SaveLogToTxt("maskVaulue:" + marginVaulue.ToString()); Log.SaveLogToTxt("jitterRMS:" + jitterRMS.ToString()); Log.SaveLogToTxt("jitterPP:" + jitterPP.ToString()); Log.SaveLogToTxt("OEOMA:" + OEOMA.ToString()); Log.SaveLogToTxt("OEOMADBM:" + OEOMADBM.ToString()); Log.SaveLogToTxt("riseTime:" + riseTime.ToString()); Log.SaveLogToTxt("fallTime:" + fallTime.ToString()); Log.SaveLogToTxt("bitRate:" + bitRate.ToString()); Log.SaveLogToTxt("maskVaulue2:" + XmarginVaulue2.ToString()); return(true); } else { Log.SaveLogToTxt("Equipments are not enough!"); return(false); } } catch (InnoExCeption ex)//from driver { //Log.SaveLogToTxt(ex.ID + ": " + ex.Message + "\r\n" + ex.StackTrace); exceptionList.Add(ex); return(false); } catch (Exception error)//from itself { //one way: deal this exception itself InnoExCeption ex = new InnoExCeption(ExceptionDictionary.Code._0xFFFFF, error.StackTrace); //Log.SaveLogToTxt(ex.ID + ": " + ex.Message + "\r\n" + ex.StackTrace); exceptionList.Add(ex); return(false); //the other way is: should throw exception, rather than the above three code. see below: //throw new InnoExCeption(ExceptionDictionary.Code._0xFFFFF, error.StackTrace); } } }
protected bool SetTxBiasAdcOffset() { try { if (biasADCs == null) { biasADCs = new ushort[GlobalParameters.TotalChCount]; for (int i = 0; i < GlobalParameters.TotalChCount; i++) { dut.ChangeChannel((i + 1).ToString()); dut.SetSoftTxDis(); Thread.Sleep(20); } for (int i = 0; i < GlobalParameters.TotalChCount; i++) { dut.ChangeChannel((i + 1).ToString()); dut.ReadBiasADC(out biasADCs[i]); Log.SaveLogToTxt("biasADC of this channel is " + biasADCs[i]); if (biasADCs[dut.MoudleChannel - 1] == 65535) { Log.SaveLogToTxt("biasADC of this channel is 65535."); return(false); } } dut.TxAllChannelEnable(); //return to current channel dut.ChangeChannel(GlobalParameters.CurrentChannel.ToString()); int sum = 0; for (int i = 0; i < biasADCs.Length; i++) { sum += biasADCs[i]; } ushort avg = (ushort)(sum / biasADCs.Length); dut.SetBiasAdcOffset(avg); Log.SaveLogToTxt("completed to set biasAdcOffset to " + avg); ushort returndata = 0; dut.ReadBiasAdcOffset(out returndata); result = (avg == returndata) ? true : false; return(result); } return(true); } catch (InnoExCeption ex)//from driver { //Log.SaveLogToTxt(ex.ID + ": " + ex.Message + "\r\n" + ex.StackTrace); exceptionList.Add(ex); return(false); } catch (Exception error)//from itself { //one way: deal this exception itself InnoExCeption ex = new InnoExCeption(ExceptionDictionary.Code._0xFFFFF, error.StackTrace); //Log.SaveLogToTxt(ex.ID + ": " + ex.Message + "\r\n" + ex.StackTrace); exceptionList.Add(ex); return(false); //the other way is: should throw exception, rather than the above three code. see below: //throw new InnoExCeption(ExceptionDictionary.Code._0xFFFFF, error.StackTrace); } }
protected bool CurveAPDandWriteCoefs() { try { #region CurveCoef string SelectCondition = "Channel=" + GlobalParameters.CurrentChannel; DataRow[] drArray = dtProcess.Select(SelectCondition); if (drArray.Length >= 2) { double[] Y = new double[drArray.Length]; double[] X = new double[drArray.Length]; for (byte i = 0; i < drArray.Length; i++) { Y[i] = double.Parse(drArray[i]["APDDAC"].ToString()); X[i] = double.Parse(drArray[i]["Formula_X"].ToString()); //Formula_X } for (int i = 0; i < X.Length; i++) { Log.SaveLogToTxt("X[" + i.ToString() + "]=" + X[i].ToString() + " " + "Y[" + i.ToString() + "]=" + Y[i].ToString()); } double[] coefArray = Algorithm.MultiLine(X, Y, tempratureADCArray.Count, 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++) { Log.SaveLogToTxt("apdCoefArray[" + i.ToString() + "]=" + apdCoefArray[i].ToString() + " " + Algorithm.ByteArraytoString(2, ",", Algorithm.FloatToIEE754(apdCoefArray[i]))); } Log.SaveLogToTxt("Step9...WriteCoef"); #region W&R Apddaccoefc isWriteCoefCOk = dut.SetAPDdaccoefc(apdPowerCoefC.ToString()); if (isWriteCoefCOk) { Log.SaveLogToTxt("isWriteCoefCOk:" + isWriteCoefCOk.ToString()); } else { Log.SaveLogToTxt("isWriteCoefCOk:" + isWriteCoefCOk.ToString()); } #endregion #region W&R Apddaccoefb isWriteCoefBOk = dut.SetAPDdaccoefb(apdPowerCoefB.ToString()); if (isWriteCoefBOk) { Log.SaveLogToTxt("isWriteCoefBOk:" + isWriteCoefBOk.ToString()); } else { Log.SaveLogToTxt("isWriteCoefBOk:" + isWriteCoefBOk.ToString()); } #endregion #region W&R Apddaccoefa isWriteCoefAOk = dut.SetAPDdaccoefa(apdPowerCoefA.ToString()); if (isWriteCoefAOk) { Log.SaveLogToTxt("isWriteCoefAOk:" + isWriteCoefAOk.ToString()); } else { Log.SaveLogToTxt("isWriteCoefAOk:" + isWriteCoefAOk.ToString()); } #endregion if (isWriteCoefAOk & isWriteCoefBOk & isWriteCoefCOk) { Log.SaveLogToTxt("isCalApdPowerOk:" + true.ToString()); } else { Log.SaveLogToTxt("isCalApdPowerOk:" + false.ToString()); return(false); } } #endregion return(true); } 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._0x02100, 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._0x02100, error.StackTrace); } }
private bool CalculateAndWriteCoeff() { try { bool result = true; //减offset double[,] matrixX = new double[matrixEachEnADC.GetLength(0), matrixEachEnADC.GetLength(1)]; for (int i = 0; i < matrixEachEnADC.GetLength(0); i++) { string info = ""; for (int j = 0; j < matrixEachEnADC.GetLength(1); j++) { info += matrixEachEnADC[i, j].ToString("f1") + " "; matrixX[i, j] = matrixEachEnADC[i, j] - matrixOffsetADC[i]; } //log matrixSingleEnable and offset Log.SaveLogToTxt("matrixSingleEnable: " + info + "matrixOffset: " + matrixOffsetADC[i]); } //计算系数 double[,] coeff = Algorithm.CalculateCoeff(matrixX, 0); //log and write coeff to DUT result = dut.WriterTxAdcCalibrateMatrix(coeff); for (int i = 0; i < coeff.GetLength(0); i++) { string info = ""; for (int j = 0; j < coeff.GetLength(1); j++) { info += coeff[i, j].ToString("f4") + " "; } Log.SaveLogToTxt("coeff: " + info); } Log.SaveLogToTxt("Write coeff to dut sucessfully"); //write offset to DUT; for (int i = 0; i < matrixOffsetADC.GetLength(0); i++) { dut.ChangeChannel((i + 1).ToString()); result = result && dut.WriterTxAdcBacklightOffset(matrixOffsetADC[i]); } Log.SaveLogToTxt("Write offset to dut sucessfully"); return(result); } 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._0x02100, 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._0x02100, error.StackTrace); } finally { dut.ChangeChannel(GlobalParameters.CurrentChannel.ToString()); } }
protected bool CurveTempDmiandWriteCoefs() { try { int tempCount = 0; if (GlobalParameters.TotalTempCount <= 0) { tempCount = Math.Min(tempratureADCArray.Count / 1, realTempratureArray.Count / 1); } else { tempCount = Math.Min(tempratureADCArray.Count / GlobalParameters.TotalTempCount, realTempratureArray.Count / GlobalParameters.TotalTempCount); } double[,] tempTempAdcArray; double[,] tempTempValueArray; if (GlobalParameters.TotalTempCount <= 0) { tempTempAdcArray = new double[1, tempCount]; tempTempValueArray = new double[1, tempCount]; } else { tempTempAdcArray = new double[GlobalParameters.TotalTempCount, tempCount]; tempTempValueArray = new double[GlobalParameters.TotalTempCount, tempCount]; } byte totalTempCount; if (GlobalParameters.TotalTempCount <= 0) { totalTempCount = 1; } else { totalTempCount = GlobalParameters.TotalTempCount; } Log.SaveLogToTxt("Step4...Start Fitting Curve"); { for (byte i = 0; i < 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 < 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]; { for (byte i = 0; i < totalTempCount; i++) { for (byte j = 0; j < tempCount; j++) { adcArray[j] = tempTempAdcArray[i, j]; realArray[j] = tempTempValueArray[i, j]; } for (byte k = 0; k < adcArray.Length; k++) { Log.SaveLogToTxt("adcArray[" + k.ToString() + "]=" + adcArray[k].ToString() + " " + "realArray[" + k.ToString() + "]=" + realArray[k].ToString()); } double[] coefArray = Algorithm.MultiLine(adcArray, realArray, tempCount, 1); tempDmiCoefC = Convert.ToSingle(coefArray[0]); tempDmiCoefB = Convert.ToSingle(coefArray[1]); tempDmiCoefArray = ArrayList.Adapter(coefArray); tempDmiCoefArray.Reverse(); for (byte k = 0; k < tempDmiCoefArray.Count; k++) { // Log.SaveLogToTxt("tempDmiCoefArray[" + k.ToString() + "]=" + tempDmiCoefArray[k].ToString() + " " + Algorithm.ByteArraytoString(2, ",", Algorithm.INT16To2Bytes(tempDmiCoefArray[k]))); Log.SaveLogToTxt("tempDmiCoefArray[" + k.ToString() + "]=" + tempDmiCoefArray[k].ToString() + " " + Algorithm.ByteArraytoString(4, ",", Algorithm.FloatToIEE754(tempDmiCoefArray[k]))); } Log.SaveLogToTxt("Step5...WriteCoef"); #region W&R Tempcoefc isWriteCoefCOk = dut.SetTempcoefc(tempDmiCoefC.ToString(), (byte)(i + 1)); if (isWriteCoefCOk) { Log.SaveLogToTxt("WritetempDmiCoefC:" + isWriteCoefCOk.ToString()); } else { Log.SaveLogToTxt("WritetempDmiCoefC:" + isWriteCoefCOk.ToString()); } #endregion #region W&R Tempcoefb isWriteCoefBOk = dut.SetTempcoefb(tempDmiCoefB.ToString(), (byte)(i + 1)); if (isWriteCoefBOk) { Log.SaveLogToTxt("WritetempDmiCoefB:" + isWriteCoefBOk.ToString()); } else { Log.SaveLogToTxt("WritetempDmiCoefB:" + isWriteCoefBOk.ToString()); } #endregion if (isWriteCoefBOk & isWriteCoefCOk) { Log.SaveLogToTxt("isCalTempDmiOk:" + true.ToString()); } else { Log.SaveLogToTxt("isCalTempDmiOk:" + false.ToString()); return(false); } } } } return(true); } 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._0x02100, 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._0x02100, error.StackTrace); } }
private bool ReadTotalChADC(string info, int channel, out double[] dataADC) { dataADC = new double[GlobalParameters.TotalChCount]; string time = DateTime.Now.ToString(); try { Log.SaveLogToTxt("Try to Clean offset/coeff."); if (!this.CleanCoeff()) { Log.SaveLogToTxt("Failed to Clean offset/coeff."); return(false); } Log.SaveLogToTxt("Clean offset/coeff sucessfully."); if (channel == 0) { Log.SaveLogToTxt("Disable all channel"); for (int i = 0; i < GlobalParameters.TotalChCount; i++) { dut.ChangeChannel((i + 1).ToString()); dut.SetSoftTxDis(); } } else { Log.SaveLogToTxt("Enable channel " + channel + "and Write bias/mod DAC"); dut.SetSingleChannelTxEnable((byte)channel); dut.WriteBiasDac(myStruct.BiasDACs[channel - 1]); dut.WriteModDac(myStruct.ModDACs[channel - 1]); } for (int i = 0; i < GlobalParameters.TotalChCount; i++) { dut.ChangeChannel((i + 1).ToString()); ushort data; if (dut.ReadTxpADC(out data)) { dataADC[i] = data; } else { Log.SaveLogToTxt("failed to read TxADC of channel" + (i + 1)); return(false); } DataRow dr = dt.NewRow(); dr[1] = time; dr[2] = GlobalParameters.CurrentTemp; dr[3] = dut.MoudleChannel; dr[4] = dataADC[i]; dr[5] = info; dt.Rows.Add(dr); string readInfo = time + " " + GlobalParameters.CurrentTemp + " " + dut.MoudleChannel + " " + dataADC[i].ToString("f1") + " " + info; Log.SaveLogToTxt("read info: " + readInfo); dr = null; } return(true); } catch (InnoExCeption ex)//from driver { //Log.SaveLogToTxt(ex.ID + ": " + ex.Message + "\r\n" + ex.StackTrace); exceptionList.Add(ex); return(false); } catch (Exception error)//from itself { //one way: deal this exception itself InnoExCeption ex = new InnoExCeption(ExceptionDictionary.Code._0xFFFFF, error.StackTrace); //Log.SaveLogToTxt(ex.ID + ": " + ex.Message + "\r\n" + ex.StackTrace); exceptionList.Add(ex); return(false); //the other way is: should throw exception, rather than the above three code. see below: //throw new InnoExCeption(ExceptionDictionary.Code._0xFFFFF, error.StackTrace); } finally { dut.ChangeChannel(GlobalParameters.CurrentChannel.ToString()); } }
protected override bool AnalysisInputParameters(TestModeEquipmentParameters[] infoList) { try { ArrayList inParaList = new ArrayList(); inParaList.Clear(); inParaList.Add("BiasDACArray"); inParaList.Add("ModDACArray"); inParaList.Add("AdjustMethod"); Log.SaveLogToTxt("Step1...Check InputParameters"); if (infoList.Length < inParaList.Count) { Log.SaveLogToTxt("InputParameters are not enough!"); return(false); } else { int index = -1; bool isParaCompleted = true; if (isParaCompleted) { if (Algorithm.FindFileName(infoList, "BIASDACARRAY", out index)) { char[] tempCharArray = new char[] { ',' }; ArrayList tempAR = Algorithm.StringtoArraylistDeletePunctuations(infoList[index].DefaultValue, tempCharArray); if (tempAR == null) { Log.SaveLogToTxt(infoList[index].FiledName + "is null!"); return(false); } else if (tempAR.Count > GlobalParameters.TotalChCount) { myStruct.BiasDACs = new ArrayList(); for (int i = 0; i < GlobalParameters.TotalChCount; i++) { myStruct.BiasDACs.Add(tempAR[i]); } } else { myStruct.BiasDACs = tempAR; } } if (Algorithm.FindFileName(infoList, "MODDACARRAY", out index)) { char[] tempCharArray = new char[] { ',' }; ArrayList tempAR = Algorithm.StringtoArraylistDeletePunctuations(infoList[index].DefaultValue, tempCharArray); if (tempAR == null) { Log.SaveLogToTxt(infoList[index].FiledName + "is null!"); return(false); } else if (tempAR.Count > GlobalParameters.TotalChCount) { myStruct.ModDACs = new ArrayList(); for (int i = 0; i < GlobalParameters.TotalChCount; i++) { myStruct.ModDACs.Add(tempAR[i]); } } else { myStruct.ModDACs = tempAR; } } if (Algorithm.FindFileName(infoList, "ADJUSTMETHOD", out index)) { double temp = Convert.ToDouble(infoList[index].DefaultValue); if (double.IsInfinity(temp) || double.IsNaN(temp)) { Log.SaveLogToTxt(infoList[index].FiledName + "is wrong!"); return(false); } else { myStruct.MethodID = Convert.ToByte(temp); } } Log.SaveLogToTxt("OK!"); return(true); } } return(true); } 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._0x02001, 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._0x02001, error.StackTrace); } }
protected override bool AnalysisOutputParameters(TestModeEquipmentParameters[] InformationList) { try { int ArrayLength = 1; if (flagReadTxpowerDmi) { ArrayLength += 1; } if (flagReadRxpowerDmi) { ArrayLength += 1; } outputParameters = new TestModeEquipmentParameters[ArrayLength]; outputParameters[0].FiledName = "Tr_ErrorRate(%)"; Ber = Algorithm.ISNaNorIfinity(Ber); outputParameters[0].DefaultValue = Ber.ToString().Trim(); if (flagReadRxpowerDmi) { DmiRxPower = Algorithm.ISNaNorIfinity(DmiRxPower); outputParameters[1].DefaultValue = DmiRxPower.ToString().Trim(); outputParameters[1].FiledName = "DmiRxPower"; } if (flagReadTxpowerDmi) { if (flagReadRxpowerDmi) { outputParameters[2].FiledName = "DmiTxPower"; DmiTxPower = Algorithm.ISNaNorIfinity(DmiTxPower); outputParameters[2].DefaultValue = DmiTxPower.ToString().Trim(); } else { outputParameters[1].FiledName = "DmiTxPower"; DmiTxPower = Algorithm.ISNaNorIfinity(DmiTxPower); outputParameters[1].DefaultValue = DmiTxPower.ToString().Trim(); } } return(true); } 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._0x02F04, 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._0x02F04, error.StackTrace); } }
protected bool SearchTargetPoint(out byte Index) { Index = 0; ArrayList serchAttPointsTemp = new ArrayList(); serchAttPointsTemp.Clear(); ArrayList serchAttPoints = serchAttPointsTemp; ArrayList serchBerPoints = serchAttPointsTemp; try { //double currentCense = 0; //byte count = 0; serchAttPoints = new ArrayList(); serchBerPoints = new ArrayList(); serchAttPoints.Clear(); serchBerPoints.Clear(); ArrayList StrLog = new ArrayList(); ushort[] rxADCs = new ushort[adjustAPDStruct.SetPoints.Length]; int count = 0; for (int i = 0; i < adjustAPDStruct.SetPoints.Length; i++) { dut.WriteAPDDac(adjustAPDStruct.SetPoints[i]); serchAttPoints.Add(adjustAPDStruct.SetPoints[i]); Thread.Sleep(200); double TempValue = pED.GetErrorRate(); if (Math.Abs(TempValue - 9.999E+17) < 1.0E-6) { count++;//记录误码不通的数量 } serchBerPoints.Add(TempValue); dut.ReadRxpADC(out rxADCs[i]); StrLog.Add("adjustAPDStruct.SetPoints[" + i + "] = " + adjustAPDStruct.SetPoints[i].ToString() + " " + " serchBerPoints[" + i + "] = " + TempValue + " RxADC[" + i + "] = " + rxADCs[i]); } for (int i = 0; i < StrLog.Count; i++) { Log.SaveLogToTxt(StrLog[i].ToString()); } if (count == adjustAPDStruct.SetPoints.Length)//如果全部不通 { return(false); } // byte Index; Algorithm.SelectMinValue(serchBerPoints, out Index); if (referenceRxADC_First == null) { referenceRxADC_First = new ushort[GlobalParameters.TotalChCount]; referenceTemp = GlobalParameters.CurrentTemp; } if (referenceTemp == GlobalParameters.CurrentTemp) { referenceRxADC_First[GlobalParameters.CurrentChannel - 1] = rxADCs[Index]; return(true); } ushort deltaRxADC = 65535; int index = Index; for (int i = 0; i < serchBerPoints.Count; i++) { if (Math.Abs(Convert.ToDouble(serchBerPoints[i]) - Convert.ToDouble(serchBerPoints[Index])) < 10 * Convert.ToDouble(serchBerPoints[Index])) { int delta = Math.Abs(rxADCs[i] - referenceRxADC_First[GlobalParameters.CurrentChannel - 1]); if (delta < deltaRxADC) { deltaRxADC = (ushort)delta; index = i; } } } Log.SaveLogToTxt("BestAPD = " + adjustAPDStruct.SetPoints[index] + " serchBerPoints = " + serchBerPoints[index] + " RxADC = " + rxADCs[index]); Index = (byte)index; return(true); } 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._0x02108, 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._0x02108, error.StackTrace); } }
private bool AdjustMethodByBinarySearch() { bool result = false; double value, rang, targetValue, targetMin, targetMax; rang = 2.0; targetValue = mySpec.TypcalValue; targetMin = targetValue - rang; targetMax = targetValue + rang; try { Int32 startDAC = myStruct.DACStart; dut.WriteCrossDac(startDAC); scope.AutoScale(); Thread.Sleep(3000); value = GetCrossing(); if (value <= targetMax && value >= targetMin) { Log.SaveLogToTxt("value is " + value); dut.StoreCrossDac(startDAC); outDAC = myStruct.DACStart; outCrossing = value; return(true); } else { int i = 0; logList.Clear(); int max = myStruct.DACMax; int min = myStruct.DACMin; while (!result && min < max) { if (startDAC > myStruct.DACMax || startDAC < myStruct.DACMin || i > 20) { break; } startDAC = min + (max - min) / 2; dut.WriteCrossDac(startDAC); scope.ClearDisplay(); Thread.Sleep(2000); value = GetCrossing(); logList.Add("DAC=" + startDAC + " Crossing=" + value); if (value < targetMin) { min = startDAC; } else if (value > targetMax) { max = startDAC; } else { dut.StoreCrossDac(startDAC); result = true; break; } } } for (int i = 0; i < logList.Count; i++) { Log.SaveLogToTxt(logList[i].ToString()); } if (value >= mySpec.SpecMin && value <= mySpec.SpecMax) { dut.StoreCrossDac(startDAC); result = true; outDAC = startDAC; outCrossing = value; Log.SaveLogToTxt("BestCrossingDAC=" + startDAC + " " + "BestCrossing=" + value.ToString()); return(true); } else { Log.SaveLogToTxt("I Can't find Best DAC "); return(false); } } catch (InnoExCeption ex)//from driver { //Log.SaveLogToTxt(ex.ID + ": " + ex.Message + "\r\n" + ex.StackTrace); exceptionList.Add(ex); return(false); } catch (Exception error)//from itself { //one way: deal this exception itself InnoExCeption ex = new InnoExCeption(ExceptionDictionary.Code._0x02108, 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._0x02108, error.StackTrace); } }
/// <summary> /// 精细查找最好的那个点 /// </summary> /// <param name="ScanArray">采样数组</param> /// <returns></returns> protected Int32 SearchBestPoint(Int32[] ScanArray) { double[] ErrorRate = new double[ScanArray.Length]; ushort[] rxADCs = new ushort[ScanArray.Length]; try { ArrayList StrLog = new ArrayList(); for (int i = 0; i < ScanArray.Length; i++) { dut.WriteAPDDac(ScanArray[i]); Thread.Sleep(200); ErrorRate[i] = pED.GetErrorRate(); dut.ReadRxpADC(out rxADCs[i]); StrLog.Add("ScanArray[" + i + "] = " + ScanArray[i] + " " + " ErrorRate[" + i + "] = " + ErrorRate[i] + " RxADC[" + i + "] = " + rxADCs[i]); } for (int i = 0; i < StrLog.Count; i++) { Log.SaveLogToTxt(StrLog[i].ToString()); } byte bIndex; ArrayList TempArray = new ArrayList(); TempArray.Clear(); for (int i = 0; i < ScanArray.Length; i++) { TempArray.Add(ErrorRate[i]); } Algorithm.SelectMinValue(TempArray, out bIndex); Log.SaveLogToTxt("BestAPD =" + ScanArray[bIndex].ToString()); Log.SaveLogToTxt("MinErrorRate =" + ErrorRate[bIndex].ToString()); //Log.SaveLogToTxt("ErrorRate[" + bIndex + "] =" + TempValue); if (referenceRxADC == null) { referenceRxADC = new ushort[GlobalParameters.TotalChCount]; referenceTemp = GlobalParameters.CurrentTemp; } if (referenceTemp == GlobalParameters.CurrentTemp) { referenceRxADC[GlobalParameters.CurrentChannel - 1] = rxADCs[bIndex]; return(int.Parse(ScanArray[bIndex].ToString())); } ushort deltaRxADC = 65535; int index = bIndex; for (int i = 0; i < ErrorRate.Length; i++) { if (Math.Abs(ErrorRate[i] - ErrorRate[bIndex]) < 10 * ErrorRate[bIndex]) { int delta = Math.Abs(rxADCs[i] - referenceRxADC[GlobalParameters.CurrentChannel - 1]); if (delta < deltaRxADC) { deltaRxADC = (ushort)delta; index = i; } } } Log.SaveLogToTxt("BestAPD = " + ScanArray[index] + " ErrorRate = " + ErrorRate[index] + " RxADC = " + rxADCs[index]); return(int.Parse(ScanArray[index].ToString())); } catch (InnoExCeption ex)//from driver { //Log.SaveLogToTxt(ex.ID + ": " + ex.Message + "\r\n" + ex.StackTrace); exceptionList.Add(ex); return(InnoExCeption.NaN); } catch (Exception error)//from itself { //one way: deal this exception itself InnoExCeption ex = new InnoExCeption(ExceptionDictionary.Code._0x02108, error.StackTrace); //Log.SaveLogToTxt(ex.ID + ": " + ex.Message + "\r\n" + ex.StackTrace); exceptionList.Add(ex); return(InnoExCeption.NaN); //the other way is: should throw exception, rather than the above three code. see below: //throw new InnoExCeption(ExceptionDictionary.Code._0x02108, error.StackTrace); } }
private bool AdjustMethod_1()// { bool flag = false; double CurrentCrossing; try { //scope.EyeTuningDisplay(0); Int32 StartDac = myStruct.DACStart; dut.WriteCrossDac(myStruct.DACStart); scope.AutoScale(); Thread.Sleep(3000); CurrentCrossing = GetCrossing(); if (CurrentCrossing <= mySpec.AdjustSpecMax && CurrentCrossing >= mySpec.AdjustSpecMin) { Log.SaveLogToTxt("CurrentCrossing is " + CurrentCrossing); dut.StoreCrossDac(StartDac); outDAC = myStruct.DACStart; outCrossing = CurrentCrossing; flag = true; return(flag); } else { flag = false; int i = 0; logList.Clear(); while (!flag) { //if (StartDac > myStruct.DACMax || StartDac < myStruct.DACMin) //{ // break; //} //if (i > 20) //{ // break; //} dut.WriteCrossDac(StartDac); scope.ClearDisplay(); Thread.Sleep(1000); CurrentCrossing = GetCrossing(); outDAC = StartDac; logList.Add("DAC=" + StartDac + " Crossing=" + CurrentCrossing); if (CurrentCrossing > mySpec.AdjustSpecMax) { StartDac -= myStruct.DacStep; } else if (CurrentCrossing < mySpec.AdjustSpecMin) { StartDac += myStruct.DacStep; } else { dut.StoreCrossDac(StartDac); flag = true; break; } if (StartDac > myStruct.DACMax || StartDac < myStruct.DACMin) { break; } if (i > 20) { break; } i++; } } for (int i = 0; i < logList.Count; i++) { Log.SaveLogToTxt(logList[i].ToString()); } // outDAC = myStruct.DACStart; //outCrossing = GetCrossing(); if (!flag && CurrentCrossing >= mySpec.SpecMin && CurrentCrossing <= mySpec.SpecMax) { flag = true; } dut.StoreCrossDac(outDAC); outCrossing = CurrentCrossing; if (flag) { Log.SaveLogToTxt("BestCrossingDAC=" + outDAC + " " + "BestCrossing=" + outCrossing.ToString()); return(true); } else { Log.SaveLogToTxt("I Can't find Best DAC "); return(false); } } catch (InnoExCeption ex)//from driver { //Log.SaveLogToTxt(ex.ID + ": " + ex.Message + "\r\n" + ex.StackTrace); exceptionList.Add(ex); return(false); } catch (Exception error)//from itself { //one way: deal this exception itself InnoExCeption ex = new InnoExCeption(ExceptionDictionary.Code._0x02108, 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._0x02108, error.StackTrace); } }
private bool AdjustAPDMethod1() { try { byte Index; if (!SearchTargetPoint(out Index))// 搜寻Testplan 中填写的 参考点 { return(false); } ScanArray = new Int32[adjustAPDStruct.ScanCount]; if (Index == 0)//如果最好值为最小的一个点 { Int32 Step = (adjustAPDStruct.SetPoints[1] - adjustAPDStruct.SetPoints[0]) / adjustAPDStruct.ScanCount; for (int i = 0; i < ScanArray.Length; i++) { ScanArray[i] = adjustAPDStruct.SetPoints[0] + i * Step; } } else if (Index == adjustAPDStruct.SetPoints.Length - 1)// 如果最好值为最大点 { Int32 Step = (adjustAPDStruct.SetPoints[Index] - adjustAPDStruct.SetPoints[Index - 1]) / adjustAPDStruct.ScanCount; for (int i = 0; i < ScanArray.Length; i++) { ScanArray[i] = adjustAPDStruct.SetPoints[Index - 1] + i * Step; } } else { Int32 MinValue = (adjustAPDStruct.SetPoints[Index] + adjustAPDStruct.SetPoints[Index - 1]) / 2; Int32 MaxValue = (adjustAPDStruct.SetPoints[Index + 1] + adjustAPDStruct.SetPoints[Index]) / 2; Int32 Step = (MaxValue - MinValue) / adjustAPDStruct.ScanCount; for (int i = 0; i < ScanArray.Length; i++) { ScanArray[i] = MinValue + i * Step; } } targetApd = SearchBestPoint(ScanArray.ToArray()); dut.StoreAPDDac(targetApd); isApdAdjustOK = true; Thread.Sleep(30000); return(true); } 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._0x02109, 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._0x02109, error.StackTrace); } }
private bool AdjustCrossing_Precision(double outCrossing, Int32 index, Int32[] DACArray, double[] itemArray) { Int32[] PrecisDAC_Array = new Int32[10]; double[] PrecisItem_Array = new double[10]; try { if (index == 0)//如果最好值为最小的一个点 { precisStep = (Int32)((DACArray[1] - DACArray[0]) / 10); for (int i = 0; i < 10; i++) { PrecisDAC_Array[i] = DACArray[0] + i * precisStep; } } else if (index == itemArray.Length)// 如果最好值为最大点 { precisStep = (Int32)((DACArray[DACArray.Length - 1] - DACArray[DACArray.Length - 2]) / 10); for (int i = 0; i < 10; i++) { PrecisDAC_Array[i] = DACArray[0] + i * precisStep; } } else { Int32 MinValue = (DACArray[index] + DACArray[index - 1]) / 2; Int32 MaxValue = (DACArray[index + 1] + DACArray[index]) / 2; precisStep = (MaxValue - MinValue) / 10; for (int i = 0; i < 10; i++) { PrecisDAC_Array[i] = MinValue + i * precisStep; } } for (int i = 0; i < 10; i++) { dut.WriteCrossDac(PrecisDAC_Array[i]); Thread.Sleep(200); scope.ClearDisplay(); Thread.Sleep(2000); PrecisItem_Array[i] = GetCrossing(); Log.SaveLogToTxt("PrecisDAC_Array[" + i.ToString() + "]=" + PrecisDAC_Array[i].ToString() + " " + "PrecisItem_Array[" + i.ToString() + "]=" + PrecisItem_Array[i].ToString()); } byte Crossingindex = GetTargetPointIndex(mySpec.TypcalValue, Array.ConvertAll(PrecisItem_Array, s => Convert.ToDouble(s))); dut.StoreCrossDac(PrecisDAC_Array[Crossingindex]); } 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._0x02108, 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._0x02108, error.StackTrace); } return(true); }
protected bool CurveVccDMIandWriteCoefs() { byte tempCOUNT; if (GlobalParameters.TotalVccCount <= 0) { tempCOUNT = 1; } else { tempCOUNT = GlobalParameters.TotalVccCount; } try { { for (byte i = 0; i < tempVccArray.Length; i++) { tempVccArray[i] = tempVccArray[i] * 10000; } for (byte i = 0; i < tempCOUNT; i++) { double[] tempAdc = new double[calVccDmiStruct.ArrayListVcc.Count]; for (byte j = 0; j < calVccDmiStruct.ArrayListVcc.Count; j++) { tempAdc[j] = vccAdcArray[i, j]; allVccAdcArray.Add(vccAdcArray[i, j]); } double[] coefArray = Algorithm.MultiLine(tempAdc, tempVccArray, calVccDmiStruct.ArrayListVcc.Count, 1); 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++) { Log.SaveLogToTxt("vccDmiCoefArray[" + k.ToString() + "]=" + vccDmiCoefArray[k].ToString() + " " + Algorithm.ByteArraytoString(2, ",", Algorithm.INT16To2Bytes(vccDmiCoefArray[k]))); } Log.SaveLogToTxt("Step4...WriteCoef"); #region W&R Vcccoefc isWriteCoefCOk = dut.SetVcccoefc(vccDmiCoefC.ToString(), (byte)(i + 1)); if (isWriteCoefCOk) { Log.SaveLogToTxt("WritevccDmiCoefC:" + isWriteCoefCOk.ToString()); } else { Log.SaveLogToTxt("WritevccDmiCoefC:" + isWriteCoefCOk.ToString()); } #endregion #region W&R Vcccoefb isWriteCoefBOk = dut.SetVcccoefb(vccDmiCoefB.ToString(), (byte)(i + 1)); if (isWriteCoefBOk) { Log.SaveLogToTxt("WritevccDmiCoefB:" + isWriteCoefBOk.ToString()); } else { Log.SaveLogToTxt("WritevccDmiCoefB:" + isWriteCoefBOk.ToString()); } #endregion //#region W&R Vcccoefa ////isWriteCoefAOk = dut.SetVcccoefa(vccDmiCoefA.ToString(), i + 1); //if (isWriteCoefAOk) //{ // isWriteCoefAOk = true; // Log.SaveLogToTxt("WritevccDmiCoefA:" + isWriteCoefAOk.ToString()); //} //else //{ // Log.SaveLogToTxt("WritevccDmiCoefA:" + isWriteCoefAOk.ToString()); //} //#endregion if (isWriteCoefBOk & isWriteCoefCOk) { Log.SaveLogToTxt("isCalVccDmiOk:" + true.ToString()); } else { Log.SaveLogToTxt("isCalVccDmiOk:" + false.ToString()); return(false); } } } return(true); } 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._0x02100, 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._0x02100, error.StackTrace); } }
private bool AdjustMask_Precision(double TargetMask, Int32 index, Int32[] DACArray, double[] itemArray) { int PrecisDAC_Array_length = 0; Int32 MinValue, MaxValue; Int32[] PrecisDAC_Array; //= new Int32[10]; double[] PrecisItem_Array; // = new double[10]; try { if (index == 0)//如果最好值为最小的一个点 { MinValue = DACArray[0]; MaxValue = DACArray[1]; } else if (index == itemArray.Length - 1)// 如果最好值为最大点 { MinValue = DACArray[DACArray.Length - 2]; MaxValue = DACArray[DACArray.Length - 1]; } else// 中间值 { MinValue = (DACArray[index] + DACArray[index - 1]) / 2; MaxValue = (DACArray[index + 1] + DACArray[index]) / 2; } PrecisStep = (Int32)((MaxValue - MinValue) / 5); if (PrecisStep <= 1) { PrecisStep = 1; PrecisDAC_Array_length = (Int32)((MaxValue - MinValue) / 1); } else { PrecisDAC_Array_length = 5; } PrecisDAC_Array = new Int32[PrecisDAC_Array_length]; PrecisItem_Array = new double[PrecisDAC_Array_length]; for (int i = 0; i < PrecisDAC_Array_length; i++) { PrecisDAC_Array[i] = MinValue + i * PrecisStep; } for (int i = 0; i < PrecisDAC_Array_length; i++) { // dut.WriteMaskDac(PrecisDAC_Array[i]); WriteMaskDAC(PrecisDAC_Array[i]); Thread.Sleep(200); pScope.ClearDisplay(); Thread.Sleep(2000); PrecisItem_Array[i] = GetMask(); Log.SaveLogToTxt("PrecisDAC_Array[" + i.ToString() + "]=" + PrecisDAC_Array[i].ToString() + " " + "PrecisItem_Array[" + i.ToString() + "]=" + PrecisItem_Array[i].ToString()); } byte Maskindex = GetTargetPointIndex(MySpec.TypcalValue, Array.ConvertAll(PrecisItem_Array, s => Convert.ToDouble(s))); //dut.StoreMaskDac(PrecisDAC_Array[Maskindex]); StoreMaskDAC(PrecisDAC_Array[Maskindex]); TargetDac = PrecisDAC_Array[Maskindex]; TargetMask = PrecisItem_Array[Maskindex]; } 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._0x02111, 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._0x02111, error.StackTrace); } return(true); }
protected override bool AnalysisOutputParameters(TestModeEquipmentParameters[] InformationList) { lock (tempScope) { try { outputParameters = new TestModeEquipmentParameters[12]; outputParameters[0].FiledName = "AP(DBM)"; apDBM = Algorithm.ISNaNorIfinity(apDBM); outputParameters[0].DefaultValue = Math.Round(apDBM, 4).ToString().Trim(); outputParameters[1].FiledName = "ER(DB)"; er = Algorithm.ISNaNorIfinity(er); outputParameters[1].DefaultValue = Math.Round(er, 4).ToString().Trim(); outputParameters[2].FiledName = "CROSSING(%)"; crossing = Algorithm.ISNaNorIfinity(crossing); outputParameters[2].DefaultValue = Math.Round(crossing, 4).ToString().Trim(); outputParameters[3].FiledName = "MASKMARGIN(%)"; marginVaulue = Algorithm.ISNaNorIfinity(marginVaulue); outputParameters[3].DefaultValue = Math.Round(marginVaulue, 4).ToString().Trim(); outputParameters[4].FiledName = "JITTERRMS(PS)"; jitterRMS = Algorithm.ISNaNorIfinity(jitterRMS); outputParameters[4].DefaultValue = Math.Round(jitterRMS, 4).ToString().Trim(); outputParameters[5].FiledName = "JITTERPP(PS)"; jitterPP = Algorithm.ISNaNorIfinity(jitterPP); outputParameters[5].DefaultValue = Math.Round(jitterPP, 4).ToString().Trim(); outputParameters[6].FiledName = "RISETIME(PS)"; riseTime = Algorithm.ISNaNorIfinity(riseTime); outputParameters[6].DefaultValue = Math.Round(riseTime, 4).ToString().Trim(); outputParameters[7].FiledName = "FALLTIME(PS)"; fallTime = Algorithm.ISNaNorIfinity(fallTime); outputParameters[7].DefaultValue = Math.Round(fallTime, 4).ToString().Trim(); outputParameters[8].FiledName = "TXOMA(DBM)"; OEOMA = Algorithm.ISNaNorIfinity(OEOMADBM); outputParameters[8].DefaultValue = Math.Round(OEOMADBM, 4).ToString().Trim(); outputParameters[9].FiledName = "EYEHEIGHT(MW)"; //EyeHeight EyeHeight = Algorithm.ISNaNorIfinity(EyeHeight); outputParameters[9].DefaultValue = Math.Round(EyeHeight, 4).ToString().Trim(); outputParameters[10].FiledName = "BitRate(GB/S)"; //EyeHeight bitRate = Algorithm.ISNaNorIfinity(bitRate); outputParameters[10].DefaultValue = Math.Round(bitRate, 4).ToString().Trim(); outputParameters[11].FiledName = "XMASKMARGIN2(%)"; //EyeHeight bitRate = Algorithm.ISNaNorIfinity(XmarginVaulue2); outputParameters[11].DefaultValue = Math.Round(XmarginVaulue2, 4).ToString().Trim(); for (int i = 0; i < outputParameters.Length; i++) { Log.SaveLogToTxt(outputParameters[i].FiledName + " : " + outputParameters[i].DefaultValue); } return(true); } 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._0x02F04, 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._0x02F04, error.StackTrace); } } }
protected override bool AnalysisOutputParameters(TestModeEquipmentParameters[] InformationList) { try { outputParameters = new TestModeEquipmentParameters[20]; outputParameters[0].FiledName = "TEMPHA"; outputParameters[0].DefaultValue = Convert.ToString(Convert.ToDouble(!tempHA)).ToString().Trim(); outputParameters[1].FiledName = "TEMPHW"; outputParameters[1].DefaultValue = Convert.ToString(Convert.ToDouble(!tempHW)).ToString().Trim(); outputParameters[2].FiledName = "TEMPLA"; outputParameters[2].DefaultValue = Convert.ToString(Convert.ToDouble(!tempLA)).ToString().Trim(); outputParameters[3].FiledName = "TEMPLW"; outputParameters[3].DefaultValue = Convert.ToString(Convert.ToDouble(!tempLW)).ToString().Trim(); outputParameters[4].FiledName = "VCCHA"; outputParameters[4].DefaultValue = Convert.ToString(Convert.ToDouble(!vccHA)).ToString().Trim(); outputParameters[5].FiledName = "VCCHW"; outputParameters[5].DefaultValue = Convert.ToString(Convert.ToDouble(!vccHW)).ToString().Trim(); outputParameters[6].FiledName = "VCCLA"; outputParameters[6].DefaultValue = Convert.ToString(Convert.ToDouble(!vccLA)).ToString().Trim(); outputParameters[7].FiledName = "VCCLW"; outputParameters[7].DefaultValue = Convert.ToString(Convert.ToDouble(!vccLW)).ToString().Trim(); outputParameters[8].FiledName = "IBIASHA"; outputParameters[8].DefaultValue = Convert.ToString(Convert.ToDouble(!ibiasHA)).ToString().Trim(); outputParameters[9].FiledName = "IBIASHW"; outputParameters[9].DefaultValue = Convert.ToString(Convert.ToDouble(!ibiasHW)).ToString().Trim(); outputParameters[10].FiledName = "IBIASLA"; outputParameters[10].DefaultValue = Convert.ToString(Convert.ToDouble(!ibiasLA)).ToString().Trim(); outputParameters[11].FiledName = "IBIASLW"; outputParameters[11].DefaultValue = Convert.ToString(Convert.ToDouble(!ibiasLW)).ToString().Trim(); outputParameters[12].FiledName = "TXPOWERHA"; outputParameters[12].DefaultValue = Convert.ToString(Convert.ToDouble(!txPowerHA)).ToString().Trim(); outputParameters[13].FiledName = "TXPOWERHW"; outputParameters[13].DefaultValue = Convert.ToString(Convert.ToDouble(!txPowerHW)).ToString().Trim(); outputParameters[14].FiledName = "TXPOWERLA"; outputParameters[14].DefaultValue = Convert.ToString(Convert.ToDouble(!txPowerLA)).ToString().Trim(); outputParameters[15].FiledName = "TXPOWERLW"; outputParameters[15].DefaultValue = Convert.ToString(Convert.ToDouble(!txPowerLW)).ToString().Trim(); outputParameters[16].FiledName = "RXPOWERHA"; outputParameters[16].DefaultValue = Convert.ToString(Convert.ToDouble(!rxPowerHA)).ToString().Trim(); outputParameters[17].FiledName = "RXPOWERHW"; outputParameters[17].DefaultValue = Convert.ToString(Convert.ToDouble(!rxPowerHW)).ToString().Trim(); outputParameters[18].FiledName = "RXPOWERLA"; outputParameters[18].DefaultValue = Convert.ToString(Convert.ToDouble(!rxPowerLA)).ToString().Trim(); outputParameters[19].FiledName = "RXPOWERLW"; outputParameters[19].DefaultValue = Convert.ToString(Convert.ToDouble(!rxPowerLW)).ToString().Trim(); return true; } 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._0x02F04, 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._0x02F04, error.StackTrace); } }