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 CurveTempDmiandWriteCoefs() { try { int tempCount = 0; if (GlobalParameters.TotalTempCount <= 0) { tempCount = Math.Min(dieTempratureArray.Count / 1, realTempratureArray.Count / 1); } else { tempCount = Math.Min(dieTempratureArray.Count / GlobalParameters.TotalTempCount, realTempratureArray.Count / GlobalParameters.TotalTempCount); } double[,] tempdieTempArray; double[,] tempTempValueArray; if (GlobalParameters.TotalTempCount <= 0) { tempdieTempArray = new double[1, tempCount]; tempTempValueArray = new double[1, tempCount]; } else { tempdieTempArray = 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, dieTempratureArray.Count); j++) { int tempstr2 = dieTempratureArray.Keys[j].ToUpper().Length; string tempstring = dieTempratureArray.Keys[j].ToUpper().Substring(dieTempratureArray.Keys[j].ToUpper().Length - 1, 1); string iStr = i.ToString().ToUpper().Trim(); if (tempstring == iStr) { tempdieTempArray[i, tempcount1] = double.Parse(dieTempratureArray.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[] dieTempArray = new double[tempCount]; double[] realArray = new double[tempCount]; { for (byte i = 0; i < totalTempCount; i++) { for (byte j = 0; j < tempCount; j++) { dieTempArray[j] = tempdieTempArray[i, j]; realArray[j] = tempTempValueArray[i, j]; } for (byte k = 0; k < dieTempArray.Length; k++) { Log.SaveLogToTxt("dieTempArray[" + k.ToString() + "]=" + dieTempArray[k].ToString() + " " + "realArray[" + k.ToString() + "]=" + realArray[k].ToString()); } double[] coefArray = Algorithm.MultiLine(dieTempArray, 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 (System.Exception ex) { throw ex; } }